AFGHANISTAN'S rival candidates have reached a breakthrough agreement for a complete audit of their contested presidential election and a national unity government.

The deal, brokered by US secretary of state John Kerry, offers a path out of what threatened to be a debilitating political crisis for Afghanistan, with both candidates claiming victory and talking of setting up competing governments.

Such a scenario could have dangerously split the fragile country's government and security forces at a time the US is pulling out most of its troops and the Taliban continues to wage a fierce insurgency.

Loading article content

Instead, former finance minister Ashraf Ghani, and former foreign minister Abdullah Abdullah, consented to abide by an internationally supervised audit of all eight million ballots in the presidential election and a national unity government once the results are announced.

The checking of votes is expected to take a "number of weeks" and will begin with ballot boxes in Kabul.