Both times when Cloud actually handed over the Black Materia, he was being directly manipulated by Sephiroth, without any control over himself. He was also under the influence of Jenova's Reunion instinct, drawing him toward Sephiroth and the North Cave. Jenova's ultimately responsible, but Hojo actually performed the experiments that led Cloud down that path.