A prime minister is gone, but that is of nothing compared to the fallout for the economy, our union and Europe. It will all have to be grappled with, and so too will the economic neglect and the social alienation which have driven Britain to the exit door

The British people have spoken. The prime minister has resigned. Already, the consequences of what the voters said and why they said it have begun to reshape Britain’s future in profound and potentially dangerous ways. The country has embarked on a perilous journey in which our politics and our economy must be transformed. The vote to leave the EU will challenge not only the government and politicians but all of us whose opinions have been rejected.

Britain’s place in the world must now be rethought. That will demand the kind of debate about our alliances that we have not had since the Suez crisis forced a post-imperial reality on Britain. Once again, the country’s very idea of itself will have to be reimagined too. The deep strains on the nation’s fabric that are partly expressed as a pro-European Scotland, Northern Ireland – and London – and an anti-European England and Wales must be urgently addressed. And a new relationship with a Europe that is in no mood to be generous must be negotiated. As a gleeful Nigel Farage pointed out early on Friday, there are also already voices from the populist right in Denmark, France and the Netherlands arguing for their own definitive vote. And while the Bank of England successfully steadied the City after dramatic early falls in the value of shares and a tumbling pound, these things will take careful management if they are not to translate into a new crunch on the banks, a recession or even – as George Soros warned earlier in the week – a sudden inability to finance the balance of payments.

David Cameron – instantly, utterly and forever broken by his defeat on Thursday – grasped that he could not lead the country through the coming turmoil. In a graceful little speech in Downing Street he accepted failure and announced that his successor would be in place by the time of the party conference in October. No speech, however, could have salvaged his standing in the history books. Mr Cameron will go down as the man who gambled the country’s future as a way out of a party difficulty. His original folly was compounded by his refusal to stand firm against his internal enemies on the detailed plans for the plebiscite, despite the authority of last year’s newly won mandate. And then the campaign itself, on which he kept tight control, failed. Project Fear’s fundamental mistake was that it did not understand that far too many Britons, already living insecure and uncertain lives, felt they had little to lose. By focusing on the City and big business, the campaign had nothing to say about the victims of the myriad failures of so many local economies. Mr Cameron won the party leadership by outflanking his rival on Euroscepticism, and in his decade at the top he did nothing to promote a positive vision of the EU. He followed rather than led; and in this sour atmosphere he bet his shirt on the notoriously fickle vehicle of a referendum, and lost.

Now the vote is in, the overriding sense is of surprise and uncertainty. Boris Johnson and Michael Gove, the two generals of the leave campaign, tried to instil some authority. There was “no haste” to start exit negotiations, they declared. But within the hour, the Scottish first minister Nicola Sturgeon declared that in these “materially different” circumstances she would set in process the machinery for a second independence referendum. She and the mayor of London, Sadiq Khan, are demanding that they be treated as parties to any negotiations. Moves for a Scottish independence vote will add to the demand for a border poll in Northern Ireland. Sinn Féin has already called for such a vote. As campaigners, the leave politicians were sometimes shambolic and often contradictory; now they have been handed victory, they have unleashed forces well beyond their control.

The immediate outlook for progressive and even humanitarian values in the UK is not encouraging. There is no denying that, even if only on the Faragiste fringes, xenophobia had its part to play in the leave campaign. The voices that thronged on the airwaves in triumph on the first dawn of the post-Brexit future were those of the Thatcherite past: Liam Fox, Iain Duncan Smith and Norman Tebbit. Such figures, who are suddenly “the masters now”, differ from Mr Cameron not only in their contempt for all endeavours European, but often also in their reactionary stance on social and other affairs. Most, but not all, of the Conservatives’ Brexit wing opposed, for example, gay marriage, the one solid progressive achievement on the home front which the outgoing prime minister could point to, as he acknowledged that his time was up. Underpinning this mostly reactionary pro-Brexit cabal in parliament is a ruthless, border-hopping and monied elite which has masked its audacious bid to grab the reins in folksy, homespun slogans.

So far, so depressing, but the liberal left – and the Labour party – need to keep a cool head and, above all, try and understand what the electorate has said. Only 13 months have passed since a general election, in which Ukip’s achievement was capped at 3.9 million votes. The leave vote was more than four times that at 17.4 million. There is not suddenly four times as much chauvinism as there was in 2015. Many of the people who voted leave are reasonable voters moved by reasonable anxieties – about wages, housing and, yes, the frailty of identity too.

Some in Europe are making noises about a summary ejection, but a disorderly departure is in no one’s interest. Angela Merkel was wisely more conciliatory. Indeed, some Europeans may soon be considering alternatives to outright departure – some form of associate membership, perhaps – or even the possibilities of a second referendum, on the divorce terms.

The self-styled proponents of progressive politics must reflect on why they have found it so tricky even to understand all of this worry, still less to do anything useful to assuage it. One prompt for soul-searching ought to be their inability to change the tone of the conversation about immigration, which has been going wrong for a decade or more; another is a failure to reckon sufficiently early with all the towns and estates left behind by an international economic order which has not treated them well. Doncaster, Wakefield and Hull – to take three northern examples – have been abandoned for decades, by London far more than by Brussels. But given the chance to vent their rage at somebody, they have obliged.

Then there are the shortcomings of the European institutions themselves, the overall brand damaged by the cruelties that the single currency has meted out on the continent’s south, and the organisational opacity which fed the charge of a democratic deficit. The slogan “vote leave, take back control” proved fatefully effective.

There is, then, serious intellectual work to do, as well as the urgent business of community politics. Door-knocking, street-campaigning and – above all – just listening, will be important in mending the link between the electors of Britain, and the mostly pro-European representatives whom they elect. Listening will yield some uncomfortable truths, like the reality that the typical pay packet is the same now as at the time of the 2008 crash. Politicians will not be respected again until they can offer practical answers, and they won’t be easy to find.

But step-by-step, all of this will need to be done. Even before that, however, the victorious Brexiters must now start to do what they’ve managed to avoid doing throughout the campaign, and settle on one particular plan for leaving the European Union. Huge questions are left hanging by the campaign, in which the leavers have disagreed on more than they agree, including whether or not the UK will in future be a member of the single European market.

The new prime minister will not be able to duck such weighty questions any longer, and the pro-European majority of MPs will be fully entitled to have a say on the answers. Before we can get to them, there is a political crisis to navigate. Britain could not be in more serious times.