Afghanistan has signed a long-delayed security deal which will allow some US troops to stay in the country next year, signalling that newly-inaugurated President Ashraf Ghani intends to repair frayed ties with Washington.

National security adviser Hanif Atmar and US ambassador James Cunningham signed the bilateral security agreement (BSA) in a televised ceremony at the presidential palace on Tuesday, a day after Ghani was inaugurated.

Hamid Karzai, who stepped down as president on Monday, had refused to sign the deal in a disagreement that came to symbolise the breakdown of Afghan-US relations.

Live Box 201491152731407786

"The signing sends the message that president Ghani fulfils his commitments," Daoud Sultanzoy, a senior aide of Ghani's, earlier told the AFP news agency.

"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."

"[The agreement] will 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," Jen Psaki, spokesperson for the US State Department, told journalists earlier on Monday.

Parallel NATO agreement

Under the terms of the agreement, troops from Germany, Italy and other NATO members will join a force of 9,800 US soldiers, bringing numbers up to about 12,500.

After NATO's combat mission ends in December, the new mission, named Resolute Support, will focus on training and support for the Afghan army and police as they take on Taliban fighters.

Negotiations over the pact had seen Karzai add new demands, shift positions and infuriated the US, Afghanistan's biggest donor.

He eventually refused to sign the agreement despite a "loya jirga" grand assembly that he convened voting for him to do so.

On the campaign trail, both Ghani and his poll rival Abdullah Abdullah had vowed to reverse Karzai's decision.

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 inaugurated a new president on Monday.

There are currently about 41,000 NATO troops in Afghanistan, down from a peak of 130,000 in 2012.

Source: Agencies