Image copyright Reuters Image caption Mr Ghani (left) and Mr Abdullah agreed to a UN-supervised recount of votes

A deal to form a united government in Afghanistan is "an Afghan solution to an Afghan problem", US Secretary of State John Kerry says.

Presidential rivals Ashraf Ghani and Abdullah Abdullah have been feuding over the result of the June elections.

"We will form a government of national unity... What unites us is far greater than what divided us during the campaign," Mr Ghani said on Friday.

Mr Kerry held talks earlier with both men in Kabul.

It is not yet clear what the government structure will be under the power-sharing deal.

Mr Ghani stressed that the deal signed on Friday was a "commitment to co-operation" and Mr Abdullah said they had both "accepted the need to work together".

The US would like a new Afghan government team to be ready in time for a Nato summit in early September.

Most foreign troops will pull out at the end of this year, though Taliban insurgents have stepped up their attacks in recent months.

Image copyright Reuters Image caption Mr Kerry (right) said the vote audit must achieve "a credible result"