Kabul: Afghanistan’s presidential rivals reached a deal on Friday to form a unity government but remained divided over the results of a contentious runoff election, sources with knowledge of the talks said.

Terms of the agreement, reached after weeks of difficult negotiations, were not immediately disclosed. Until hours before the agreement, the candidates, Ashraf Gani and Abdullah Abdullah, were tussling over the powers to be held by the new post of chief executive, created after US Secretary of State John F. Kerry held talks with the rivals in Kabul this summer.

But aides to Gani and Abdullah, who spoke on condition of anonymity because they were not authorised to discuss the sensitive talks, said the two sides had not agreed on the results of a United Nations-supervised recount of all 8 million ballots cast in a June runoff, which was initiated after Abdullah alleged widespread fraud. The runoff followed a presidential election in April.

Afghanistan’s Independent Election Commission scheduled an announcement for Saturday afternoon at which Gani was expected to be named the winner by a comfortable margin that one official said was about 11 percentage points.

Abdullah’s campaign is reportedly contesting that figure, arguing that many fraudulent ballots cast in Gani’s favour were not eliminated in the recount. Gani is eager to have the results announced to bolster his legitimacy after a long, turbulent campaign that threatened to deepen Afghanistan’s ethnic and political fault lines.

But Abdullah’s camp was believed to have agreed to assume the chief executive position once Gani is named the winner. The new post was envisioned as a way to bring the runner-up into the government and ease a potentially destabilising crisis sparked by Abdullah’s fraud allegations.

It was not immediately clear whether the executive post would be taken up by Abdullah, a former foreign minister and aide to slain Afghan militia commander Ahmad Shah Massoud, or another member of his team.

One official said one of the final hurdles to the agreement on a unity government was Gani’s opposition to a provision that said the government would be formed by the president and the chief executive together. Gani contended that that provision would take away powers constitutionally granted to the president, the source said.

Gani’s campaign said the provision also would undermine his likely election victory because it would signal that his legitimacy “comes from the national unity government, not the elections,” the official said.

Gani, a former finance minister, has argued that the president should appoint the chief executive and retain the dual role as head of state and government, with the option to consult the chief executive.

The Abdullah campaign said that under a communique signed by the two sides last month, the chief executive would be the head of government. Mohammad Mohaqeq, one of Abdullah’s running mates, said in an interview last weekend that the chief executive would lead the Cabinet and council of ministers — but Gani said ceding authority over the Cabinet was a “red line” he wouldn’t accept.

US officials have said for days that the sides were close to an agreement that the Obama administration hopes will keep Afghanistan on a democratic path and cement a pact to keep up to 10,000 US troops in the country after this year.

Jan Kubis, the ranking UN official in Afghanistan, said on Thursday that a national unity government was the only “way forward” for Afghanistan.

“In a government of national unity there will be no losers, only partners,” he said.