Cory Monteith
Ryan Murphy has had to rewrite the ending of Glee because of Cory Monteith's death (Reuters)

Glee creator Ryan Murphy has confirmed the musical hit TV series will finish after the next season following the death of its lead star Cory Monteith.

Murphy said the show will come to an end after series six and that he has had to come up with a new finale because his original plan was to centre on Finn, played by Monteith, and Rachel, played by Lea Michele.

He told TVLine: "The final year of the show, which will be next year, was designed around Rachel and Cory/Finn's story. I always knew that, I always knew how it would end.

Cory Monteith
The final series was supposed to focus on Rachel and Finn's relationship, Murphy said (Reuters)

"I knew what the last shot was, he was in it. I knew what the last line was, she said it to him. So when a tragedy like that happens you sort of have to pause and figure out what you want to do, so we're figuring that out now."

Monteith, 31, died from an overdose of heroin and alcohol in July. He was found dead in a Vancouver hotel room with two empty bottles of champagne. He had struggled with drug and alcohol in the past.

The coroner classified his death of accidental: "Mr Monteith was found in a collapsed position the hotel room floor. It appeared that Mr Monteith had been dead for several hours."

Ryan Murphy
Murphy said he has an idea of how to end the show (Reuters)

Murphy said that while he is not certain of how he will end the series without Monteith, he has got an idea of the finale.

"I have a good idea. I'm going to tell the studio and the network [in a week] how after Cory's unfortunate passing we can end the show that I think is very satisfactory. And kind of in his honor, which I love."

A special tribute episode dedicated to Monteith called The Quarterback was aired on 10 October and drew 7.4m viewers.