Steven Moffat has revealed that the story of The Time of the Doctor had been planned since Matt Smith joined the show.
Speaking to Doctor Who Magazine, Moffat said: “When I started writing Matt’s Doctor, I thought, ‘What if everything he was involved in was in some way a consequence of a battle he was fighting in his last episode?’”
“That’s what I was thinking,” he continued. “So there’s a battle out there in his last episode, and, as a result of a battle that he hasn’t got involved in yet, things are coming back in time and getting at him. And he won’t know what they are, or understand what they are, until he gets there.”
“That was the plan. And that’s what we’ve done!”