I was home in the US at a gathering of senior US officials, scholars and politicians when someone announced Joe Biden had withdrawn from the presidential race.

A majority in the room probably thought he should bow out, but the news still struck like a thunderbolt. There were gasps and even tears. Then came talk of the cold political calculations of what comes next.

The logic of Biden stepping down was becoming overwhelming. He was never going to recover from his disastrous debate performance against Donald Trump.

His already weak polling numbers in swing states such as Pennsylvania, Michigan and Wisconsin were starting to sag into unrecoverable territory and threatened to take out other candidates and hand the presidency, the House and the Senate to Republicans.

Fundraising was drying up too, as donors either sought to pressure Biden to get out or questioned whether their money was being well spent. Growing numbers of Democrats in congress were calling publicly for him to quit. And the growing confidence of the Trump camp, reflected in the selection of populist JD Vance as potential vice-president, seemed to amplify the Democrats’ most primal fears about what a Trump administration would do to their agenda – if not democracy itself.

The only question was whether stubborn Joe Biden, the guy from Scranton, Pennsylvania – who has been underestimated throughout his career, and yet almost always managed to stage a fightback – would believe in his own past or in the mathematical reality about his future. In the end, reality won.

Biden might have gone down in history vilified by his party for having let Trump return. He will now go down as a selfless patriot who cared about the Democratic Party and the country before his own political fortunes.

Biden endorsed Vice-President Kamala Harris and she quickly secured support from all the key parts of the Democratic Party, including the Black Congressional Caucus, members of the Progressive Caucus, and moderates such as former president Bill Clinton.

Where Biden was causing fissures, Harris has at least demonstrated she can finally bring unity against a Republican Party that was in lock-step behind Trump at its convention in Milwaukee last week.

Harris resets the race in other ways that will help Democrats. First, the Trump campaign’s whole strategy was aimed at Biden but must now contend with a younger candidate who will amplify the fact that Trump too is old at 78.

Second, Harris can now make the case against Trump in a way that Biden could not because of the president’s fading communication skills and the fact he himself was the centre of controversy and national news.

Third, Harris can now reboot the campaign with a vice-presidential candidate who gives the Democrats a potential advantage in swing states. Pennsylvania and Michigan are key, so watch governors Josh Shapiro and Gretchen Whitmer.

Their ability to win in “purple” states will help Harris more broadly since she hails from California and is not particularly experienced at winning over blue-collar voters from the Midwest. Most importantly, there is now a chance to energise Democratic voters since turnout is so important in American elections.

But there are still big questions about Harris as a candidate. She was not impressive when she ran against Biden in the Democratic primary in 2020. Her campaign was disorganised, she did not have a compelling message or policy package, and she often came across as less than genuine.

There are reasons to believe she will be better this time. For one thing, she is inheriting a massive campaign and financing machine, and a clear policy agenda and message from Biden.

Her recent campaign appearances also show she is better at attacking Trump than she was when at making the case for her candidacy in the Democratic primary. Still, Democrats are waiting to be reassured.

Another problem for Harris will be that Biden put her in charge of the issue where polls show Trump has the strongest advantage – immigration. The strong dollar and low unemployment are probably the main reasons for the surge in illegal immigration, and Harris can point out that when congress reached a bipartisan deal to solve the problem, Trump convinced his followers to block it.

But results matter and Trump’s horror stories of illegal immigration coupled with pictures of Harris visiting the border to “fix” the problem will be prominent in the Republicans’ forthcoming attack campaign.

The Democratic Convention in Chicago on August 19-22 is also a cloud on the horizon. The last time an incumbent president chose not to run was when Lyndon Johnson announced in April 1968 that he would not seek a second term.

The convention in Chicago that summer was disastrous for the Democrats’ chances, as candidates vied for the position in a chaotic brokered convention and anti-Vietnam War protesters clashed with police on the streets outside.

This time Harris is unlikely to face a serious challenge, but there is no guarantee the delegates will all fall in line, even if the vast majority are Biden delegates. The fact Barack Obama called for an open process is noteworthy. More problematic will be the possible image of anti-Israel protesters in the streets or the convention hall. None of this is as existential as it was in 1968, but the ghost of that convention still scares Democrats.

Then there are questions about the mechanics of switching from Biden to Harris. Republican House Speaker Mike Johnson has signalled that there are some states where his party might challenge efforts to put Harris at the top of the ticket. That litigation will probably not work, but if the Republicans get one or two lucky rulings that force Harris to be a write-in candidate it could tilt things against her.

Overall, this resets the race and gives the Democrats a fighting chance. But who knows what happens next. American politics has never looked so much like a game of footy.