This year's Doctor Who Christmas special is based on a story by Hitchhiker's Guide to the Galaxy author Douglas Adams that producers refused to run in the 1970s.

The Christmas Day episode features the Doctor going into retirement and living on his own, and was inspired by an idea Douglas Adams had when he was script editor of the show more than 30 years ago.

The show's current chief writer, Steven Moffat, said it was a brilliant idea for a story.

"The Doctor has retired," said Moffat. "He's withdrawn from the world and hidden himself away in his battered old Tardis. No more friends, no more world-saving, no more heartbreak. What could it possibly take to bring him back in to the world again?

"Douglas Adams pitched that story many, many years ago. Back in the late 1970s the production office said no, but I remember reading about it and thinking it sounded so great that if I ever had the chance that would be one hell of a story to tell."

Adams, who died in 2001, wanted to write The Doctor Retires for Tom Baker but the show's producer at the time, Graham Williams, would not allow him.

Adams was instead compelled to write another story called Shada, but because of strike action that episode was also never broadcast.