This has been a miserable summer for Joe Biden but with the last troops out of Afghanistan the Democrat will now hope to relaunch his struggling presidency back home.
From the initial chaos in which Afghans tried clinging to departing US planes, to last Thursday's deaths of 13 US service members in a suicide bombing, the evacuation from Taliban-controlled Kabul has been ugly and traumatic.
How much it has hurt Biden politically is the question ricocheting around the White House, Congress and a divided nation.
A longtime former senator and two-term vice president, Biden long boasted of his foreign policy expertise. With close allies like Britain upset over the abrupt Afghan pullout and China mocking US policy from the sidelines, those claims are now tarnished.
Some Republicans have demanded impeachment and government resignations.
Right-wing media, such as the hugely popular Fox News, is pushing the image of 78-year-old Biden as incapable of coping in a crisis. Even usually more friendly outlets like CNN have turned hard on the president's performance in Afghanistan.
Many analysts, however, think that Americans' traditional disinterest in what happens beyond their borders will spare Biden longterm consequences.
"Usually foreign policy is not a major concern, unless there is a major crisis at the time of the election, like a war about to start," said David Karol, who teaches politics at the University of Maryland.
"The idea that this is the end of the presidency is very overblown."
With Americans out of the fighting in Afghanistan, Biden clearly hopes to pivot his administration's resources to the home front.
This was always his instinct, in some respects borrowing from his predecessor Donald Trump's focus on ending post-9/11 "forever wars" and instead rebuilding the United States.
President Joe Biden.President Joe Biden. President Joe Biden (Screengrab)
Unlike Trump, however, Biden actually has a strategy -- a startlingly ambitious blueprint to pour more than $4 trillion into the country's creaky infrastructure and social safety net.
Against all expectations, the two packages under consideration have got through the Senate and are now pending votes in the House of Representatives, even if the slender Democratic majority there means final passage is far from guaranteed.
Allan Lichtman, a professor of history and politics at American University, said presidents, like Ronald Reagan in the 1980s, often weather foreign policy crises.
By contrast, George H.W. Bush, whom he termed one of the most successful presidents in the 20th century on foreign policy, was beaten by Bill Clinton after serving just one term.
Clinton appealed to voters with a famed 1992 campaign motto of "the economy, stupid" -- something Biden will now try to emulate.
Will Afghanistan haunt Biden?
It may work, Lichtman said.
New bridges, expanded free education, and ramping up things like electric car charging networks, is "going to mean more for the American people than Afghanistan six months from now."
The flip side is that Biden's plan may fail to pass in Congress. He may also yet end up paying a price for the surging Covid Delta variant, after having initially seemed to get the pandemic under control.
And James Jay Carafano, a national security expert at the conservative Heritage Foundation think tank, warned that Afghanistan is going to "plague" Biden.
What if the Taliban invites al-Qaeda back in, reestablishing the partnership that gave birth to Osama bin Laden's 9/11 plot two decades ago? What if Americans remaining in Afghanistan are taken hostage?
"The Afghanistan problem is not going anywhere for this administration," he said.
And quite apart from facing more foreign threats in the wake of the Afghanistan defeat, Biden will also find his authority at home diminished, Carafano said.
"I think it's actually going to make the domestic issues harder because people are going to say you're so incompetent."