Afghanistan and the United States on Tuesday signed a deal to allow some US troops to stay in the country next year, signalling that new President Ashraf Ghani intends to mend frayed ties with Washington.
Hamid Karzai, who stepped down as president on Monday, refused to sign the deal in a disagreement that symbolized the breakdown of Afghan-US relations after the optimism of 2001 when the Taliban were ousted from power.
Afghan National Security Adviser Hanif Atmar and US Ambassador James Cunningham inked the document at a ceremony in the presidential palace in Kabul as Ghani stood behind the pair looking on.
"The signing sends the message that President Ghani fulfils his commitments. He promised it would be signed the day after inauguration," Daoud Sultanzoy, a senior aide of Ghani's, told AFP before the ceremony.
"It shows the president's commitment to the Afghan security forces and confidence in our future relationship with the US. We are replacing uncertainty with certainty."
US State Department spokeswoman Jen Psaki said the deal would "enable Afghanistan, the United States and the international community to maintain the partnership we've established to ensure Afghanistan maintains and extends the gains of the past decade."
US-led NATO combat troops are due to withdraw by the end of this year, lending added urgency to reaching an agreement on a residual force.
A parallel deal between Afghanistan and NATO was also due to be signed on Tuesday.
Troops from Germany, Italy and other NATO members will join a force of 9,800 US soldiers, bringing numbers up to about 12,500.
The new mission – named Resolute Support – will focus on training and supporting the Afghan army and police as they take on the Taliban insurgents.
Negotiations over the pact saw Karzai at his most unpredictable as he added new demands, shifted positions and infuriated the United States, Afghanistan's biggest donor.
He eventually refused to sign the agreement despite a "loya jirga" grand assembly which he convened voting for him to do so. There was also widespread public support for US troops to stay.
On the campaign trail, both Ghani and his poll rival Abdullah Abdullah vowed to reverse Karzai's decision.
Taliban strength
Without a deal Washington had threatened to pull all US forces out by the end of the year, but it chose to wait through a long election deadlock until Afghanistan finally got a new president on Monday.
With the Taliban on the advance in many provinces, NATO support next year is seen as essential despite Afghan troops making rapid strides.
The failure to sign a similar deal with Iraq in 2011 led to a complete withdrawal of US troops from the country, which is now engulfed in Islamist violence.
There are currently about 41,000 NATO troops in Afghanistan, down from a peak of 130,000 in 2012.
US President Barack Obama has previously announced that under the deal the US force will be halved by the end of next year, before being reduced to a normal embassy protection presence by the end of 2016.
In his inauguration speech, Ghani called for the Taliban to join peace talks after 13 years of war.
The militant group, which dismissed the election as a US plot, has often said it will fight on until all foreign troops have left Afghanistan.
The security threat in Kabul was underlined on Monday by a suicide attack outside the airport's main entrance that killed four members of the Afghan security forces and three civilians shortly before the inauguration.
On Tuesday Ghani started his first day in office with a visit to schools in Kabul.
The inauguration marked the country's first democratic transfer of power, although the UN said the election was beset by "significant fraud".