Chris Chibnall tried to persuade Peter Capaldi to do 'Doctor Who' for another year.

Peter Capaldi as Doctor Who

Peter Capaldi as Doctor Who

The 58-year-old actor - who joined the sci-fi series in 2013 - announced last month that he was bowing out as the iconic Time Lord when current show runner Steven Moffat walks away from the show once the festive special wraps up later this year.

But, according to Moffat, the 46-year-old writer - who pens the drama 'Broadchurch' and also wrote the mini series 'Gracepoint' - was desperate for Capaldi to stay as the time-travelling scientist when he bagged the job as the new boss last year.

Moffat told Broadcast magazine: "Chris tried to persuade him to stay. I knew it was a possibility that [Capaldi would] leave because Doctors tend to do three years. I thought that he might want to opt out, rather than go through the trauma of a change in command and maybe leaving a year later anyway. He came close to staying."

'Doctor Who' fans went into mourning last year when Moffat announced he was stepping down as the show's writer after seven years in charge, but he has admitted he almost walked away from the series when Matt Smith left as the Doctor in 2013

He explained: "For various reasons, during my third series I wasn't as happy. It was the only time doing 'Doctor Who' where I felt it was slipping away from me a bit. I wasn't quite as in control of it as I should be. I wasn't enjoying it as much, and I wasn't as pleased with it. I didn't want to leave like that, so I tried to persuade Matt to do another year, but he was determined to go. And then having cast a new Doctor, I had to stay - and I wanted to because I was thoroughly enjoying working with Peter."

And, although he can still return to the show to help pen series with Chibnall, Moffat has admitted he'll probably regret his decision to quit for "the rest of his life."

He added: "I'm sure I'll miss it for the rest of my life and reminisce to very bored people about how I used to be something, I used to matter, then sob on their shoulder and get kicked out the pub."