Once The Avengers bring back the Sceptre from Strucker's facility, Tony (and JARVIS) start running some diagnostics on it. Eventually, they find some kind of AI (Artificial Intelligence) residing within the gem. This AI turns out to be Ultron which suppresses JARVIS and starts uploading it's consciousness into the Iron Legion drones.
But, how does Ultron (or his consciousness) end up in Loki's Sceptre at the first place?
Has the existence of Ultron residing inside the Sceptre ever been touched upon in the Marvel Cinematic Universe?
Update: Based on the first answer here I would like to further clarify the scope of this question.
Is Ultron a godlike being (as portrayed in the Comics) residing within the Sceptre? If yes, how did he end up there? Or is it a tech created by Tony Stark and powered by the Mind Stone?