Steven Moffat has quit his role as lead writer and executive producer of Doctor Who, the BBC has said.
He will be replaced by Broadchurch creator Chris Chibnall.
A Doctor Who Christmas special will air later this year, while series 10, Moffat's last, is scheduled to be broadcast in 2017, with a new companion on board to replace Jenna Coleman.
Chibnall will begin his tenure as executive producer of Doctor Who in 2018.
Moffat said: "Feels odd to be talking about leaving when I'm just starting work on the scripts for season 10, but the fact is my timey-wimey is running out."
He added: "While Chris is doing his last run of Broadchurch, I'll be finishing up on the best job in the universe and keeping the Tardis warm for him.
"It took a lot of gin and tonic to talk him into this, but I am beyond delighted that one of the true stars of British television drama will be taking the Time Lord even further into the future."
Moffat joked: "At the start of season 11, Chris Chibnall will become the new showrunner of Doctor Who. And I will be thrown in a skip."
Chibnal said: "Doctor Who is the ultimate BBC programme: bold, unique, vastly entertaining, and adored all around the world.
"So it's a privilege and a joy to be the next curator of this funny, scary and emotional family drama.
"I've loved Doctor Who since I was four years old, and I'm relishing the thought of working with the exceptional team at BBC Wales to create new characters, creatures and worlds for the Doctor to explore."
The Broadchurch boss also paid tribute to Moffat.
"Steven's achieved the impossible by continually expanding Doctor Who's creative ambition, while growing its global popularity," he said.
"He's been a dazzling and daring showrunner, and hearing his plans and stories for 2017, it's clear he'll be going out with a bang. Just to make my life difficult."
Controller of BBC One Charlotte Moore said: "I want to thank Steven Moffat for everything he has given Doctor Who. I've loved working with him, he is an absolute genius and has brought fans all over the world such joy.
"I will be very sad to see him leave the show, but I can't wait to see what he will deliver in his last ever series next year with a brand new companion.
"I would also like to take this opportunity to welcome Chris Chibnall, a wonderfully talented writer who I know will bring something very special to the hit series."
Moffat took over Doctor Who in 2010 and during his tenure, the show has grown into a global success.
He was responsible for introducing the 11th and 12th Doctors in Matt Smith and Peter Capaldi, in addition to casting Karen Gillan as companion Amy Pond and Coleman as Clara Oswald.
Moffat was also at the helm for the 50th Anniversary special in 2013 which saw fans around the globe celebrate the world's longest running sci-fi series with Doctors, Matt Smith, David Tennant and John Hurt fighting the Daleks in a feature length episode.
Why are you making commenting on The Herald only available to subscribers?
It should have been a safe space for informed debate, somewhere for readers to discuss issues around the biggest stories of the day, but all too often the below the line comments on most websites have become bogged down by off-topic discussions and abuse.
heraldscotland.com is tackling this problem by allowing only subscribers to comment.
We are doing this to improve the experience for our loyal readers and we believe it will reduce the ability of trolls and troublemakers, who occasionally find their way onto our site, to abuse our journalists and readers. We also hope it will help the comments section fulfil its promise as a part of Scotland's conversation with itself.
We are lucky at The Herald. We are read by an informed, educated readership who can add their knowledge and insights to our stories.
That is invaluable.
We are making the subscriber-only change to support our valued readers, who tell us they don't want the site cluttered up with irrelevant comments, untruths and abuse.
In the past, the journalist’s job was to collect and distribute information to the audience. Technology means that readers can shape a discussion. We look forward to hearing from you on heraldscotland.com
Comments & Moderation
Readers’ comments: You are personally liable for the content of any comments you upload to this website, so please act responsibly. We do not pre-moderate or monitor readers’ comments appearing on our websites, but we do post-moderate in response to complaints we receive or otherwise when a potential problem comes to our attention. You can make a complaint by using the ‘report this post’ link . We may then apply our discretion under the user terms to amend or delete comments.
Post moderation is undertaken full-time 9am-6pm on weekdays, and on a part-time basis outwith those hours.
Read the rules here