Last week Joe Biden was celebrating.

He had secured a big legislative win when the US Senate backed a $1 trillion infrastructure bill.

It was a rare moment of bipartisan agreement that helped deliver one of the US president's signature pledges.

Within days however the celebratory mood in the White House had quickly evaporated as the Taliban regained control of Afghanistan.

President Biden's holiday in Camp David had to be cut short as he rushed back to Washington to deliver an address to the nation amid the unfolding crisis.

He defended the pulling out of troops.

"I stand squarely behind my decision. After 20 years, I've learned the hard way that there was never a good time to withdraw US forces," he said.

The US President did acknowledge that the situation in Afghanistan deteriorated far more quickly than they had anticipated but insisted that the mission had never been about nation building, rather it was about tackling terrorism.

He also warned the Taliban that the response to any attack would be "swift and forceful" and that the US would defend its people with "devastating force if necessary".

Joe Biden pictured in Camp David on a video conference call about the worsening situation in Afghanistan

The White House has been playing the blame game in recent days, pointing the finger at the Afghan government for its failure to mount a defence.

"We spent 20 years, tens of billions of dollars training them, giving them the best equipment, giving them support of US forces for 20 years and when push came to shove, they decided not to step up and fight for their country," the US National Security Adviser Jake Sullivan said.

The Biden administration has also claimed that its hands were tied by a deal agreed by the previous US president Donald Trump which established a deadline of 1 May to withdraw US troops from Afghanistan.

"If the president had decided to stay, all gloves would have been off. We would have been back at war with the Taliban," the US Secretary of State Antony Blinken said.

Bringing US troops home from Afghanistan has always been politically popular among Americans, the majority of whom are keen to see an end to never-ending conflicts in foreign lands.

But now, after 20 years, the country's longest war is ending in chaos.

Thousands of lives have been lost, trillions of dollars have been spent but the Taliban is back in power leaving many asking what was the point of it all?

Joe Biden is facing harsh criticism over his handling of the withdrawal after insisting last month that it would be orderly.

"There's going to be no circumstance where you see people being lifted off the roof of an embassy of the United States in Afghanistan," he said on 8 July.

"The likelihood there's going to be the Taliban overrunning everything and owning the whole country is highly unlikely," he added.

Those words are now coming back to haunt the US President as he faces the biggest international crisis of his presidency so far.

Just six days ago, Joe Biden was looking forward to a summer break in Camp David following a big bipartisan win.

What a difference a week makes.