Isaac Asimov writes about this in the book Foundation and Earth. One my favorite books!!!

"On the approach to Earth, they detect that it is highly radioactive, and not capable of supporting life, but, while trying to use the ship's computer to locate Solaria, Fallom calls Trevize's attention upon the moon, which is big enough to serve as a hideout for the forces that lived on Earth. They land on there and find R. Daneel Olivaw, who explains that he has been paternalistically manipulating humanity for many millennia, and indeed, since Elijah Baley's time, which was long before the Galactic Empire or Foundation. He caused the settlement of Alpha Centauri, the creation of Gaia, and the creation of psychohistory (detailed in Prelude to Foundation and Forward the Foundation). He also manipulated Trevize into making his decision at the end of Foundation's Edge (although he did not manipulate the decision itself)."