A devastated Ed Miliband has resigned as leader of the Labour party, saying he is truly sorry for the scale of the party’s crushing defeat.

In an emotional speech, Miliband said it was time for someone else to take over as leader, but called on the party to keep fighting, rather than give in to despair.

“I take absolute and total responsibility for our defeat. I am so sorry for all of those colleagues who lost their seats,” he said on Friday.

He said the party now needed an “open and honest debate” about the best way of rebuilding after the heavy losses, particularly to the Scottish National party.

Ed Miliband's political career in pictures

Read more

In a night of tribulation and tears, Labour lost all but one of its seats in Scotland – including those of the Scottish Labour leader, Jim Murphy, and the party’s campaign manager, Douglas Alexander. Overall, the party is down by about 25 seats, making it a worse defeat than under Gordon Brown in 2010. The most surprising result of the night was the unexpected defeat of the shadow chancellor, Ed Balls, one of the few genuine big beasts of the party.

Having phoned David Cameron to concede, Miliband called on his supporters and activists not to lose heart, even if they were now feeling “bleak”.

“While we may have lost the election, the argument of our campaign will not go away. The issue of our unequal country will not go away,” he said.

“This is the issue of our time, the fight goes on and, whoever is our new leader, I know Labour will keep making the case for a country that works for working people once again.”

Ending on a defiant note, he said: “This party has come back before and will come back again.”

He will hand over to the deputy leader, Harriet Harman, after the VE day commemoration event on Friday afternoon. She will act as a caretaker leader until a new leader can be elected.

Speculation will immediately turn to possible contenders for the leadership, including the shadow business secretary, Chuka Umunna; the shadow health secretary, Andy Burnham; the shadow health minister, Liz Kendall; and the shadow justice minister, Dan Jarvis. Burnham will start as favourite, but the party will scrutinise each leader closely.

It is also expected that Tom Watson will stand for the post of deputy leader, offering himself as the kind of man who can build the party organisation. It is not known if Yvette Cooper, the shadow home secretary, will want to stand as her family deals with the loss of her husband Ed Balls’ seat..

There had been some discussion that Miliband would stay on as a caretaker leader – just as Michael Howard did after the Conservative defeat in 2005 – but it appears he has decided it is better to have an immediate break.

Miliband’s close staff are said to be deeply upset, struggling with the disappointment made deeper by opinion polls that led them to believe they had blocked Cameron from beating a clear path back to Downing Street. Miliband described the result as very difficult and disappointing, adding that the party in Scotland had been overwhelmed by a surge of nationalism.

The new leader will face a mountainous task and a daunting five-year haul to the next election. The precise rules of the electoral college that votes for the leader may also be in flux because reforms introduced by the party have not yet been fully implemented. The unions were critical to the victory for Miliband in 2010 when he defeated his brother, David, who won the votes of the constituency party members.

Some union leaders will be questioning whether they should break from the party, or at least demand major changes on electoral reform, Europe and immigration. Labour will be concerned over signs that Ukip is establishing a secure foothold in the north of England and Wales.

In many respects Miliband had presented the agenda the unions wanted on issues such as workers’ rights, tax and regulation of markets. But some union leaders will argue that the party’s problems are deep-seated, dating back to the period of New Labour, when it lost touch with its working-class base, reflected in the surge of support for Ukip.

Labour faces a deep dilemma since the party in Scotland will be demanding a new anti-establishment voice, as well as a new identity politics, and others in England will be calling for the development of a more centrist party that reflects the needs of England.

The former Labour cabinet minister John Reid said: “There is no point changing the captain on the bridge if the ship is heading in the wrong direction.” He said elections were not won or lost in a short campaign, but over years, calling for the party to return to issues of wealth creation, as well as wealth distribution.

T​here is no point changing the captain on the bridge if the ship is heading in the wrong direction

Former Labour cabinet minister John Reid

The first test of the party mood will come when the party stages an internal election in London for its mayoral candidate. At present, Tessa Jowell, the former Labour cabinet minister, is the frontrunner.

Party staffers say the pain has been made worse by misleading opinion polls and the relatively strong campaign performance of Miliband.

Labour was expecting a result in which the Tories scored only 270 to 290 seats. Its internal focus groups were showing the party was being hit by Cameron’s repeated warnings of a minority Labour party government in thrall to a rampant leftwing SNP demanding concessions on borrowing and independence. But this concern did not appear to be reflected in the national opinion polls.

Labour staff said there had been an unholy alliance between the SNP and the Conservatives in which the SNP leader, Nicola Sturgeon, repeatedly used the vocabulary and threats designed to alarm English voters.

But the party is also reflecting on whether mistakes were made in the first few months of Miliband’s leadership, when he refused to make concessions to the public belief that the crash in 2007 and 2008 had been exacerbated by Labour overspending. The party’s economic offer by the time of the election was blurred as Labour refused to spell out a clear deficit reduction timetable.

But others believed Miliband was mistaken in failing to defend more of the New Labour record.

One of the most eloquent and honest Labour bloggers, Mark Ferguson, editor of Labour List, reflected the despair in Labour ranks. He wrote: “I thought Miliband offered a chance to build a different kind of Britain. But the British people disagreed. They didn’t buy what we were selling, how we sold it or who was selling it. In fact, all too many didn’t know what we were selling at all.

“A party too isolated in terms of geography, mindset and pure human contact from the British people can never hope to prevail against a surprisingly resilient and resurgent Tory party – and a tidal wave of nationalism. If we stay trapped where we are right now, we’ll lose again.”