In the days that have passed since Labour’s historic defeat, the party has descended into bitter recriminations. A battle is now under way to define it along factional lines: to his critics, the defeat was a rejection of Jeremy Corbyn’s leadership and his politics; to his cheerleaders it could all be explained away by the party’s support for a second referendum on Brexit. The truth, of course, is far more complicated than either of those explanations, though each play a part in that defeat.

The purpose of any analysis must be to understand what went wrong so it can be put right. That’s why it is futile to focus on factors outside the party’s control. Yes, there was a ferocious assault from the press, the Liberal Democrats and the Green party stood in seats that they could not win, and the Tories ran a campaign of dirty tricks. But these are not new phenomena. Labour needs the serenity to accept the things it cannot change, the courage to change the things it can, and the wisdom to know the difference.

Nearly half of the seat losses can be attributed to losing more remainers to other parties

How did Labour come to squander the promise of its unexpectedly good result in 2017? A central part of the explanation was dither and delay on Brexit, which meant that Labour lost ground with both leavers and remainers. Some early analysis from Datapraxis suggests that nearly half of the Labour seat losses could be attributed to losing more remainers to other parties than the size of the Tory majority in leave seats. By attempting to triangulate, Labour convinced leavers it was for remain and remainers that it was for leave. The party looked cynical and opportunistic, as if it were playing games on Brexit to secure electoral advantage, rather than sticking to its principles or standing up for the national interest. The damage came from the journey rather than the destination of Labour’s position.

Proudly internationalist throughout its history, Labour was never going to fully embrace a form of Brexit that would decimate manufacturing jobs and damage living standards. It could always be outflanked by those willing to adopt an extreme leave position because they did not share these values or concerns. When Theresa May was forced from office, it was obvious that any possibility of a soft Brexit vanished. As Labour dithered on a second referendum, its support began to nosedive with remainers, a process accelerated by the calamitous decision to not properly fight the European elections. The Lib Dems, having been marginalised since the end of the coalition government, were gifted a new lease of life by that decision. The result was that by the time the general election came round, Labour had a mountain to climb to win back remainers, which split its focus from persuading its leave supporters to “come home to Labour”.

The strategy to retain its support from leave voters was to offer a compelling domestic programme, reflecting deep concern over the NHS, low wages and austerity. But Labour let down its activists by blurting out a cacophony of policies, such that it was virtually impossible to communicate on the doorstep. The national campaign had no coherence, switching topic every day, seemingly at random.

Displaying precisely the message discipline that Labour lacked, the Conservatives’ offer of 20,000 more police officers, 50,000 more nurses, and 40 new hospitals was judged more believable, even if each false claim could be easily debunked. In an age marked by cynicism, much of the public simply do not believe the promises made by politicians. Labour’s answer was to make even more promises. Their approach was like asking activists and voters to drink water from a fire hydrant.

Vilification of Corbyn in broadcast media 'fuelled election defeat' – shadow minister Read more

As Labour members seek to make sense of what happened, they must also confront the reality that some of the people around Corbyn trampled over the ideals of Corbynism. They destroyed the moral standing of a lifelong anti-racism campaigner by choosing to interpret antisemitism as a factional issue rather than a moral one. They prevented the heir to Tony Benn fulfilling his commitment to member-led democracy by seizing control of selections for themselves. They brought bullying, threats and intimidation to the office of a man famed for being kind, gentle and polite. This is an unavoidable part of the story of Labour’s failure.

The truth is that the problems Labour faced cannot be disentangled from the question of leadership. Corbyn faced a barrage of attacks – that he tolerated antisemitism, supported the IRA and other terrorists, disliked the monarchy and didn’t support the armed forces – that were more ferocious than any other party leader in living memory. But the problem with Corbyn’s leadership was not the things outside his control, but those over which he had full power. While he reaffirmed the values of social justice and helped Labour to rediscover its radicalism, he was unable to rise to the challenge of one of the toughest jobs in public life.

As Labour now looks to the future, it faces an enormous task. It needs a leader who is able to heal the divisions of recent years and energise and reassure a desperately disappointed movement. They will also will need to repair and rebuild a party bureaucracy that faces financial difficulties and is awaiting the findings of an Equalities and Human Rights Commission investigation. The party needs a leader of stature who can navigate the storms ahead and take the party to victory in 2024, while remaining anchored to the values and ideals that make a Labour government a worthwhile endeavour. The question now is who can rise to this challenge.

• Tom Kibasi is a writer and researcher on politics and economics