Labour MPs have suffered a serious setback in their attempts to oust Jeremy Corbyn after he secured an automatic place in the upcoming leadership contest.

His opponents had he would be forced to try to win nominations from at least 20 per cent of Labour's MPs and MEPs.

More than 50 members of his shadow cabinet have walked out on him in the the last few weeks.

They are protesting at what they say was his lack of leadership during the European Union referendum.

The party now faces a divisive leadership contest this summer, just 10 months after the last one finished.

Mr Corbyn has earlier threatened to take his own party to court if he was excluded from the ballot.

Last night said he hoped that a court case instigated by his own MPs could be avoided.

The Islington MP said that he hoped “there would not be a legal challenge”.

“I think we are fine,” he added.

He also said that he was "delighted" that he would automatically be a candidate.

But John McTernan, a former adviser to Tony Blair and ex-Scottish Labour leader Jim Murphy, said it was a “terribly, terribly sad day” and that the unions, who supported Mr Corbyn, had “destroyed the Labour party”.

Mr Corbyn was a key “factor” behind the UK voting to leave the EU, he added.

But he predicted that Labour MPs would “fight for every second of every hour of every day to defeat” the veteran socialist.

Labour’s party's ruling national executive committee voted 18-14 that Mr Corbyn would automatically be on the ballot paper.

The decision followed almost six hours of discussion at the party's headquarters in London.

Some Labour MPs had believed that Mr Corbyn would struggle to secure the 51 nominations needed in the wake of the Brexit vote.

Angela Eagle, who at the weekend announced her leadership campaign, said that she welcomed the contest ahead and was “determined to win it".

But the decision makes Mr Corbyn now the favourite in the contest.

More than 100,000 people have joined the party in recent days, most to vote for him as leader.

Speculation is also mounting that the party could eventually split if Mr Corbyn remains in the top job.

As jubilant supporters cheered Mr Corbyn, he told reporters: "I'm sure Labour MPs will understand that the party has to come together in order to present to the British people the options of a different and better way of doing things."

Pledging to campaign "on all the things that matter", he said anyone who had any disagreements should "come and talk about it".

Mr Corbyn said: "I have been elected, last year, 10 months ago today, with a very large mandate. I respect that mandate. It's a responsibility I'm carrying out.

"I would hope there isn't going to be a legal challenge. There's been a very long legal discussion this afternoon. There were very well-qualified lawyers on hand to advise, so I think we are fine."

A Labour spokesman said: "The NEC has agreed that as the incumbent leader JeremyCorbyn will go forward onto the ballot without requiring nominations from the Parliamentary Labour Party and the European Parliamentary Labour Party.

"All other leadership candidates will require nominations from 20% of the PLP and EPLP."

Transport union TSSA said that "good sense" had won out.

General secretary Manuel Cortes said: "I am glad to see cool heads and good sense have prevailed at today's Labour Party NEC and should there now be a leadership contest that Jeremy will indeed be allowed to be on the ballot in accordance with party rules.

"Let's face it, with the Tories united behind Theresa May and our NEC now united behind Jeremy Corbyn it would be better for our members, better for our party and most of all, better for our country, if all sides of the party now come together, agree that we have more in common than that which divides us and work together to deliver a united and effective opposition to Theresa May's Tory government.

"But if there is yet to be a leadership contest, let it be conducted in a comradely manner and we at the TSSA look forward to supporting Jeremy continue to develop and expose his positive programme for the next Labour government."