Six weeks ago, when Labour was more than 20 points behind the Conservatives in the opinion polls, I said that the gap would narrow and, with hope in my heart, that I believed we could win the election.

I argued that when the broadcast media rules kicked in during the election period, we would have a better chance to get our policies across. The more balanced the broadcast coverage of Jeremy Corbyn, the more people would see him for the honest, decent, principled and indeed strong leader he was.

Voices and votes: leaders' personalities were crucial in unexpected election result Read more

All that is now history. Whoever leaked our manifesto to damage us, in fact did us a favour. Instead of a day’s coverage of our policies, we received several days of scrutiny, significant parts of which, at least on the broadcast media, were relatively balanced.

The manifesto proved to be a hugely popular boost. The manifesto policies were received for what they are: commonsense solutions to the issues we all face in our society.

When people saw Jeremy on television, most liked what they saw. They recognised him for what he is: a decent man who knows his mind and is determined to achieve his aims, but who engages with people and does not hector them like most politicians.

From then on, the momentum stayed with Labour, despite the suspension of campaigning after the two horrific terror attacks in Manchester and London. We were pitted against a barrage of highly personalised and poisonous Tory attacks, and a policy-free, expensively funded campaign in the press and on Facebook. My judgment is that if the campaign had been a couple of weeks longer, we would have secured a majority, given the narrowness of the voting in so many seats.

So what have we learned? First, no party has won this election outright and both major parties now have the right to put their policies and ideas before parliament. Labour did not win an overall majority but neither did the Tories, and the millions who voted for us must have a voice in determining the future of our country.

We will place before parliament policies drawn from our manifesto that we believe are needed to address the challenges Britain now faces and can command support. The issue is who can get the widest support in parliament that reflects the majority of the electorate.

The issue now is who can get the widest support in parliament that reflects the majority of the electorate

Second, the prime minister consistently told us loud and clear that she specifically called the election to secure a clear mandate from the British people to negotiate a Tory Brexit. She failed.

It is absolutely clear that there is no majority for the race-to-the-bottom Brexit backed by May, and that an alternative is required, reflecting the common ground that appears to have emerged in this debate. This is the implementation of a Brexit that respects the referendum decision and secures the greater freedoms leaving the EU achieves, but which best protects our economy, jobs and living standards.

Third, the politics of hope have largely overcome the politics of fear. Our political system has never been so scarred by the scale of vicious personal attacks, lies and smears that we witnessed in this election campaign. All were based upon terrifying people into voting against something or someone, rather than inspiring them with hope for a different future.

This election demonstrated the large-scale rejection of such politics and may have brought about the first real cracks in the edifice of control of popular political debate by the media-owning oligarchs.

And, finally, never again will young people be taken for granted by politicians in this country. The arrogant view that young people don’t count because they don’t vote has thankfully been smashed for ever.

John McDonnell is shadow chancellor and MP for Hayes and Harlington