Steven Moffat has quit his role as lead writer and executive producer of Doctor Who, the BBC says.
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.
"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," Moffat said.
"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."
Chibnall said: "Doctor Who is the ultimate BBC program: 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."
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.