The US military has spent billions of dollars since 2001 fighting the Taliban insurgency in Afghanistan.
But the end may finally be in sight for America's military presence in the country if the current talks taking place in Doha between the United States and the Taliban reach a successful conclusion.
Afghan President Ashraf Ghani has said the war has "cost the United States government and society $500bn".
How accurate is this figure and how might it have been reached?
US troop levels in Afghanistan
2002 - 2018
Source: Special Inspector General for Afghanistan Reconstruction
The US invaded Afghanistan in October 2001, accusing the Taliban of harbouring Osama bin Laden and senior al-Qaeda figures linked to the 9/11 attacks.
They removed the Taliban from power, after which the militant group started a long-running insurgency across the country.
US troop numbers in Afghanistan grew as Washington poured in billions of dollars to fight the Taliban and fund reconstruction.
Between 2010 to 2012, when the US for a time had more than 100,000 soldiers in the country, the cost of the war grew to almost $100bn a year, according to figures provided by the US government.
As the US military shifted its focus away from offensive operations and concentrated more on training Afghan forces, costs fell sharply and between 2016 and 2018 annual expenditure was around $40bn.
The estimated spend for the year to March 2019 is $18bn.
US cost of war in Afghanistan
2001 - 2019
Source: US Department of Defense
So, according to the US Department of Defense, the total military expenditure in Afghanistan (from October 2001 until March 2019) was $760bn.
That's significantly more than the figure given by the Afghan president.
But an independent study carried out by Brown University's Cost of War Project argues that the official US figures for Afghanistan are a substantial underestimate.
It says they do not include spending on war veterans' care, money spent on other government departments for war-related activities and the cost of interest on debt incurred to pay for the war.
It estimates the total cost, factoring in these additional elements, is closer to one trillion US dollars.
Where has the money gone?
The bulk of the money has been spent on counter-insurgency operations, and on the needs of US troops, such as food, clothing, medical care, special pay and benefits.
Official data shows the US has also contributed approximately $133bn -16% of all money spent in the last 17 years - to reconstruction efforts in Afghanistan.
And more than half of that ($83bn) has gone on building up Afghan security forces, including the Afghan National Army and police force.Image copyrightGETTY IMAGESImage captionAfghan security forces have suffered heavy casualties
The rest has been mainly spent on improving governance and infrastructure, as well as on economic and humanitarian aid and anti-drug initiatives.
The US has spent on average $1.5m day - or nearly $9bn since 2002 until June this year - on anti-narcotics efforts, yet the area devoted to growing opium poppy has actually increased, according to UN figures.
In 2017, the US watchdog responsible for the oversight of reconstruction efforts said that as much as $15.5bn had been lost on "waste, fraud and abuse" over the past 11 years.
That figure is probably "only a portion" of the total waste, according to the watchdog, which added that US money "often exacerbated conflicts, enabled corruption, and bolstered support for insurgents".
What about the human cost?
Since the war against the Taliban began in 2001, US forces have suffered 2,300 deaths and around 20,500 soldiers injured in action.
According to official figures, approximately 14,000 US military personnel were in Afghanistan as of June 2018, but there were also nearly 11,000 US civilians who were working as contractors.
But US casualty figures are dwarfed by the loss of life among Afghan security forces and civilians.
President Ghani said this year that more than 45,000 members of the Afghan security forces had been killed since he became president in 2014.
Total civilian casualties in Afghanistan
2009 - 2019*
Source: UN Assistance Mission in Afghanistan (*2019 casualties to 30 Jun)
Mr Ghani's decision to reveal casualty figures was unusual, as the US and Afghan governments don't normally publish Afghan death tolls.
However, some reports say that Afghan security force fatalities have been very high in recent years, sometimes averaging 30-40 deaths a day.
And according to the United Nations Assistance Mission in Afghanistan (Unama), more than 32,000 civilians have been killed and about 60,000 injured since it began systematically recording civilian casualties in 2009.