Costume crime drama Ripper Street has been resurrected and is heading back to the BBC as part of a deal with internet giant Amazon that will see it premiere online before being shown on TV.
The new series of the show, axed last year after the BBC said it "didn't bring the audience we hoped", will be shown first on Amazon's on-demand Prime Instant service which will also re-run the first two series.
Cast members including Matthew Macfadyen and Jerome Flynn, who both play detectives working in 19th century Whitechapel in east London, start filming in May.
Jason Ropell, head of Amazon instant video international content acquisition, said: "We're delighted to have secured not only the highly popular first two seasons of Ripper Street for our Prime Instant Video customers, but we can also confirm today that we will making season three, news that we know will delight the millions of fans of this brilliant British drama."
BBC drama boss Ben Stephenson said this was "an exceptional opportunity" to bring the show back.
He said: "This deal gives fans another series of the show they love at excellent value to the licence fee-payer, ensuring that the BBC can also commission an entirely new, yet-to-be-announced drama series."
The third series, which will begin shooting in May, will be a co-production with the BBC, which will contribute funding.
Producer Simon Vaughn, chief executive of Lookout Point, said: "The BBC are contributing to the production costs; in fact, we had to get a lot of people to contribute to the production costs. Amazon are the White Knight who came to the rescue.
"However, everybody still loves the show. We've got broadcasters around the world, BBC America, who are broadcasting the show very happily, BBC, who all love the show. So it was an easy sell and about getting five or six people back to the table and everybody seeing there was a new way to keep the show on the road."
Writer Richard Warlow said he had always planned more series of the show and said the new partnership with Amazon would allow a way of adding more "bells and whistles" to the production which were not possible when it was being made just for BBC One.