One of the reasons Theresa May decided to go for an early election was her anxiety over what would happen if she couldn't achieve her aims in the Brexit deal, or if she failed to get a deal at all.

She has promised Parliament a vote on the terms of our exit from the EU. She thought she could probably get those terms through the House of Commons. She had a working majority of 16, after all, plus a cushion of Labour Eurosceptics and the DUP. It was the House of Lords she was worried about.

The Lords had passed the Article 50 Bill, to start the formal procedure for leaving the EU, but it was not happy about it. Its members felt they had to accept the will of the people as expressed in the referendum, but Ms May was worried that when it came to the Brexit terms, a year and a half later, the mood would have changed.

General Election 2017: Big beasts who lost their seats Show all 7 1 /7 General Election 2017: Big beasts who lost their seats General Election 2017: Big beasts who lost their seats Nick Clegg Picture By Darren O'Brien/Guzelian Picture Shows Former MP, Nick Clegg delivers a speech despite losing the Sheffield Hallam Seat. Labour candidate, Jared O'Mara (Front), defeats Nick Clegg to take the Sheffield Hallam seat. picture taken 08/06/2017 Darren O'Brien General Election 2017: Big beasts who lost their seats Gavin Barwell LONDON, ENGLAND - OCTOBER 07: Gavin Barwell MP arrives at Number 10 Downing Street on October 7, 2013 in London, England. British Prime Minister David Cameron announced a Government reshuffle today. (Photo by Oli Scarff/Getty Images) Getty General Election 2017: Big beasts who lost their seats Angus Robertson General Election 2017: Big beasts who lost their seats Nicola Blackwood PA General Election 2017: Big beasts who lost their seats Alex Salmond PA General Election 2017: Big beasts who lost their seats Rob Wilson Mandatory Credit: Photo by Geoffrey Swaine/REX (1096138i) Rob Wilson, Conservative MP for Reading Funeral of Murdered Student Asha Muneer at Rivermead Leisure Centre, Reading, Britain - 28 Jan 2010 Rex Features General Election 2017: Big beasts who lost their seats Ben Gummer Minister for the Cabinet Office Ben Gummer arriving at 10 Downing Street, London for the weekly cabinet meeting. PA

The election was supposed to solve this problem. Not only would it guarantee the backing of the Commons – she would have a majority of Conservative MPs elected on her Brexit manifesto – but it would force the Lords to yield. The Salisbury Convention, agreed in 1945 by Lord Salisbury, the leader of the Conservatives in the Lords, is that the upper house will not oppose measures that were promised in a governing party’s manifesto. This was to get round the problem of a large Conservative majority in the Lords facing Clement Attlee’s government in the Commons, backed by a landslide democratic mandate.

But the Salisbury Convention supposes that the the governing party in the Commons has won a majority of seats on its manifesto. Theresa May failed to do so. That means not only will she – or her successor – find it harder to get the Brexit terms through the Commons, but that there is a real chance they will be opposed in the Lords.

Then what happens? No one knows. When May promised a vote in Parliament at the end of the Brexit process, she did not say what would happen if Parliament said no. But if it did, we might discover that triggering Article 50 was revocable after all. It would depend on the attitude of the other 27 EU member states. There is a provision in Article 50 for the negotiating period to be extended – if everyone agrees.

It may be that the EU 27 just want to get rid of us, in which case there is little point, but if they don’t and they see the prospect of a change of mind and a second referendum, then we could be in for more years of negotiations.

The consequence of our indecisive election result is greater than whether Theresa May stays or goes – and it is certainly greater than today’s departure of Fiona Hill and Nick Timothy, her joint chiefs of staff. Presumably May rushed to Buckingham Palace yesterday – and made a speech in Downing Street in such haste she forgot to commiserate with defeated candidates – because she wanted to pre-empt any attempt by Tory MPs to oust her. But they will probably force her out sooner or later.

Two of Theresa May's closest aides quit following General Election result

And whoever succeeds her will face the same problem: that they will have no mandate for whatever form of Brexit they are able to negotiate. The problems will come sooner than that, too: the Great Repeal Bill, to convert EU law into British law in preparation for departure, is about to start its passage. That could be difficult in the House of Lords.

One way round this is to call another election and win it decisively. The idea of re-running this election and hoping for a better result is not a prospect Boris Johnson, David Davis, Amber Rudd or Philip Hammond would find attractive.

If the Conservative Party does go down that route, though, it needs to learn three lessons. One, it must have a full leadership contest that puts the candidates through the fire of the hustings so that it chooses someone who actually likes campaigning. Two, the general election campaign should be shorter than seven weeks. Three, fiscal responsibility can go hang: the party will have to offer free money to students, and shouldn’t threaten to take away money from pensioners.

If there isn’t another election, I suspect an idea I heard from a Labour MP on Friday will get more of an airing. He wasn’t proposing a “government of national unity”, the kind of grand coalition of Conservative and Labour that was often proposed in the 1970s, the last time our politics seemed so deadlocked. But he was thinking aloud about party co-operation on Brexit and joint commission to oversee the negotiations and to try to secure a cross-party consensus for whatever came out of them.

I doubt that Jeremy Corbyn and Keir Starmer, his shadow Brexit Secretary, would offer such a thing, or that a Conservative prime minister would accept it. And it would be, by definition, hard to find a consensus between people who want to leave the EU and those, such as the majority of the House of Lords, who want to stay.