When Peter Capaldi revealed on Monday that he would be leaving Doctor Who after the next series, it came as a surprise to many fans. "I've never worked the same job for three years, and I feel like now is the right time to move on," he told BBC Radio 2.
Naturally, the announcement has sparked a wave of speculation; it has been variously suggested that the BBC were desperate for him to stay on, and that they pushed him out. But Capaldi's portayal of the character has been met with widespread acclaim from the critics - so why is he quitting a job he so clearly loved? Here are some possible reasons:
The show's ratings were falling
During Capaldi's time on the show, its overnight ratings have fallen considerably: only 6.1 million people tuned in to watch the live broadcast of the last Christmas special, while the David Tennant-era episodes were regularly drawing more than 10 million live viewers.
The rise in online catch-up viewing is partly responsible, and this is undoubtedly the case with a show like Doctor Who, that skews towards a younger demographic; consolidated viewing figures for the show tend to be much higher. Accounting for catch-up viewing, the audience for 2016's special was a slight improvement (0.1 m) on Capaldi's previous Christmas outing.
But there's another number that matters just as much to the BBC: the Audience Appreciation Index, or AI, a score out of 100 which measures viewers' enjoyment. If a cult sci-fi show is drawing a smaller audience, but that audience adores it more than ever, the public service broadcaster can justifiably call it a success. Sadly, this isn't the case for Doctor Who.
In recent years, the average AI for a BBC or ITV drama has been in the mid-80s. But - despite the popularity of the most recent Christmas special - Doctor Who's AI has also taken a hit. In the last series, it dipped below 80 for the first time since 2005 with Sleep No More, a particularly knotty episode written by Stephen Moffat's Sherlock co-creator Mark Gatiss, that came under fire for its inconsistent plotting.
There are perennial complaints about the show being too frightening for children, but the real danger is self-indulgent, overly-complex writing. As the viewing figures had already begun to decline in the previous Doctor Matt Smith's final series, it would make more sense to lay any blame at Moffat's door, rather than Capaldi's. A fresh start would certainly be welcome, but for once it isn't the Doctor who needs to regenerate.
He'd been ready to leave for a long time
Was Capaldi's resignation really a shock to anyone? The Sun has claimed he said he would be staying in the role "for a long time," misquoting an interview the actor gave to The Andrew Marr Show in December. Referring to fans who recognise him on the street, Capaldi mused, "I won't be [The Doctor] forever. There will be a day when people don't come to say hello."
Asked when that day would be, he replied: "Oh, not for a long time, I hope." In the context of the interview, he was referring more to how long public recognition would last, than making any guarantee about his future in the role.
In fact, the supposed U-turn follows several other interviews in which the actor sounded far less certain about his tenure in the Tardis. Back in 2015, ahead of that year's Christmas special, he told the Telegraph: "This could be my final year - it's terrifying. I love Doctor Who but it can be quite an insular world and I do want to do other things."
Now aged 58, Capaldi was the oldest to take up the role since the first Doctor, William Hartnell (setting aside John Hurt's one-off cameo). All the physical strain of swerving down corridors to avoid the Cybermen led to Capaldi having keyhole surgery for a damaged knee in 2015 (the same injury Matt Smith sustained during his time on the show).
Two years later, Capaldi may simply feel exhausted with the job. "The cost of doing Doctor Who, to an individual, is immense," he has said. At the time, he was speaking about head writer Steven Moffat, but he could just as easily have been talking about himself.
Steven Moffat is leaving, so Capaldi has to follow him
It's possible that Capaldi would have been written out anyway, when long-serving showrunner Steven Moffat leaves after the next series. The new Doctor Who chief, Broadchurch creator Chris Chibnall, will undoubtedly be keen to put his own stamp on the show. The simplest way to do this would be to introduce a new Doctor - and some fans have been hoping to see his Broadchurch colleague Olivia Colman take up the challenge.
Even if Chibnall were happy to work with Capaldi, he would still want to mark a clear divide from the Moffat era of Doctor Who - which, like his work on Sherlock, has been criticised over-convoluted writing.
But Capaldi will certainly feel loyal to the man who fulfilled his childhood dream of one day playing the Doctor. Speaking to Newsweek last year, he revealed that the alien with two hearts was also in two minds about working with Chibnall. When asked if he would stay on, Capaldi said: "I don't know yet... Obviously things are going to change with it and I might want to carry on and see what that's like - or I might not. It's a very difficult decision to make... when it's time to say goodbye."
He wanted to avoid typecasting
When Capaldi took up the role, he was in a very different position to both David Tennant and Matt Smith. Unlike the younger actors, he already had a career-defining role under his belt, as foul-mouthed spin doctor Malcolm Tucker in Armando Iannuci's political satire The Thick of It.
Stepping into the Tardis was a smart career move for Capaldi, allowing him to dispel the ghost of Malcolm, and demonstrate his range as an actor. But staying too long would risk replacing one obvious source of typecasting with another. After three years, he will have roughly matched Matt Smith's time on the show, and gone far beyond Christopher Eccleston, who bowed out after a single series.
He was fed up with the BBC
In the past, Capaldi has accused the broadcaster of taking Doctor Who for granted, blaming the show's falling ratings on poor scheduling. In the last series, the show was moved from its family-friendly teatime slot, shunted around the timetables to suit the Strictly live shows, and frequently finished post-watershed.
"It's not being looked after," he complained last year. "I think maybe their eye was taken off the ball, or the show was seen as a thing they could just push around. It's not. It's a special thing... If you're going to have a family show, I think you have to build up a little ritual around it - and that ritual usually starts with having it on at the same time. Even I didn't know what time it was on because it got later and later and later."
It's unlikely poor timetabling alone was enough to make Capaldi quit, but it's indicative of a wider problem: by prioritising Strictly, and aiming for easy reality TV ratings, the BBC accidentally damaged a 50-year-old institution. As we learnt in the Sylvester McCoy years, the arrival of a talented, mercurial Scottish actor isn't enough to save it, if the writing has taken a dive and BBC no longer takes an interest in the show. What a programme about time-travel needs is some sense of how to prepare for the future.