Image copyright Reuters Image caption US Secretary of State John Kerry helped to negotiate an audit of the election result

The US says it hopes a key bilateral security agreement with Afghanistan can be signed before the end of the month.

It comes after a deal to form a new unity government was signed on Sunday, breaking months of political deadlock.

US Secretary of State John Kerry said the deal "offers a huge opportunity for progress in Afghanistan".

The security agreement will determine the number of US soldiers to remain in Afghanistan after most foreign troops withdraw at the end of the year.

The outgoing President, Hamid Karzai, had refused to sign it while he remained in office.

Both candidates in the country's recent presidential election, Ashraf Ghani and Abdullah Abdullah, had promised to sign the agreement once elected, but the election result has been delayed by months of political deadlock.

Under the unity deal, Mr Ghani becomes president while runner-up Abdullah Abdullah nominates a CEO with powers similar to those of prime minister.

The power-sharing deal comes after months of wrangling following presidential elections in April and June.

'Huge opportunity'

John Kerry congratulated both men on the signing of the unity deal.

He said the deal offered an opportunity for the signing of a bilateral security agreement (BSA) between the US and Afghanistan "in a week or so".

Image copyright Reuters Image caption Abdullah Abdullah (l) and Ashraf Ghani signed the power-sharing agreement in the presidential palace in Kabul

Under the BSA, some foreign special forces are expected to stay in the country to conduct "counter-terror operations" and others to support and train Afghan forces

The US is planning to significantly reduce the number of its troops in Afghanistan before the end of the year.

Mr Kerry had helped to broker a comprehensive audit of all eight million votes in the election.

The audit was completed earlier this month but the final tallies have not been made public amid fears over unrest.

Afghanistan's election commission did declare Mr Ghani as the winner, however, in a statement on Sunday.

Both sides had accused the other of fraud following the election and the months of uncertainty have damaged the economy and worsened insecurity.