Sherlock will return for a third series, its creators have revealed after a dramatic conclusion to the second run of the BBC One drama.
Ahead of series two, co-creator Steven Moffat told BBC News there was "no guarantee we'll be bringing him back".
But on Sunday night, Moffat wrote on Twitter: "Of course there's going to be a third series - it was commissioned at the same time as the second. Gotcha!"
It was watched by an average audience of 7.9 million overnight figures show.
That compared with the 8.8 million average audience of the opening episode on New Year's Day.
The modern take on Sir Arthur Conan Doyle's detective tales stars Benedict Cumberbatch in the title role.
Moffat's co-creator Mark Gatiss also wrote on Twitter: "Gotcha! And of course there'll be a third series!"
Conan Doyle's The Final Problem, published in 1893, ended with Holmes and his arch-enemy Professor Moriarty apparently falling to their deaths at the Reichenbach Falls in Switzerland.
Conan Doyle later resurrected his hero.
Sunday night's episode was called The Reichenbach Fall. In interviews in December to promote the show - which also stars Martin Freeman as Holmes' sidekick Doctor Watson - Moffat, Gatiss and cast members had hinted the second series could be the last.
Asked by BBC News, how much freedom writers had to move away from the plot of Conan Doyle's original stories, Moffat said: "Complete freedom. It's like telling the story again so there's no guarantee we'll be bringing him back."
And asked if there would be a third series in an interview published by website Digital Spy last week, Moffat replied: "If he survives."
There is no indication of when the third series would be transmitted, but it is likely to be next year at the earliest, as its stars are both involved in major Hollywood movies.
Cumberbatch was recently cast as the villain in the new Star Trek film, while Freeman is currently shooting The Hobbit in New Zealand.
However, Freeman has signalled his willingness to return, telling the BBC's Graham Norton Show: "It's one of the few things I've done ever really where I think 'I'd like to do a lot of these'".
"It's a very nice way to spend your time.
"The hope, the plan, is that we will do a third series."
The latest, three-part series of Sherlock has been lauded by critics.
The Guardian's Sam Wollaston said Sunday night's episode was, at times "faithful to Sir ACD's The Final Problem, then it will wander, taking in mobile phone technology and computer hacking and what have you".
"But it doesn't feel like cheating; more like an open relationship, agreed by both parties."
The Daily Telegraph's Sarah Crompton said Cumberbatch was "riding the wave of what has been a triumph".