There is one person in the country who knows how Theresa May feels now and that is David Cameron. We have now had two Prime Ministers in a row who took a gamble on a vote they didn’t need to hold and who lost.

Because even if this exit poll has understated the Conservative total, as the last one did (it was 15 seats out), we are in hung parliament territory or very close to it. She may need the DUP, which won eight seats last time, to hold on to No 10, but we may be in the sort of hung parliament where a minority Labour government will be able to piece together enough support to put through a Queen’s Speech.

Unless the exit poll is a long way out, it is hard to see how May can stay on as leader. Her party would never forgive her for holding an unnecessary election and losing seats. Boris Johnson and Amber Rudd may find themselves arguing about who is fit to drive the other home after a party once more, in a leadership election in which David Davis might be the surprise candidate who comes through the middle.

It is impossible to tell from the raw numbers what might have happened, but it would seem that most of the opinion pollsters over-corrected for their error last time. Survation, whose final poll gave the Conservatives a one-point lead, will have won the contest.

Something extraordinary has happened. Nothing has ever happened like this in British politics: to start from so far ahead in the polls and go down to defeat or something so close to it is unprecedented. The only comparable case is Edward Heath in 1974 who called an election over his dispute with the unions. He didn’t have to have an election then and the British people punished him for it. There may be an element of that today, that people thought it was arrogant to take them for granted and they have decided to remind May who is boss.

It means that the Conservatives didn’t know what they were doing all along. I thought their campaign seemed lacking in edge, but I assumed that their polling showed it was on track. The Prime Minister went to all the seats you would expect her to go to if the numbers were telling her that she could gain 20-40 seats. As ever, her operation was extremely tight: if there was panic at Tory HQ, it never leaked out to us journalists. Jim Messina and Mark Textor, the Tories’ pollsters even publicly mocked YouGov on Twitter for coming up with its model suggesting the Tories would lose seats.

Emily Thornberry calls for May to resign after exit poll shock

It was obvious that no one was really in charge of the campaign: Lynton Crosby was a semi-detached adviser rather than the supreme commander who ran the 2015 campaign, with all Cameron and George Osborne’s authority behind him, blaring out Queen’s “One Vision” from his computer in the Tory war room. I thought it didn’t matter because the Tory campaign seemed to be running smoothly. It turns out it was running on autopilot and the Prime Minister was visiting Potemkin villages that looked winnable but were really enemy territory.

The consequences of this election are unclear until we know who the prime minister will be at the end of it, but it throws the Brexit question, which most voters seemed to accept was settled, back into the kind of uncertainty that will spook the markets. If this was a second referendum on Brexit, then it was as close as the first.