KABUL (Reuters) - Afghanistan's election commission declared former finance minister Ashraf Ghani as the war-ravaged country's president-elect on Sunday after an acrimonious dispute over fraud, but did not give the final vote tally after a U.N.-monitory audit.

The announcement came hours after Ghani and rival, Abdullah Abdullah, signed a power-sharing agreement to end two months of bitter wrangling over accusations of fraud that undermined confidence in the election and emboldened the Taliban insurgency at a crucial time as most foreign troops prepare to leave.

Independent Election Commission chairman Ahmad Yousuf Nuristani acknowledged grave flaws in the election process and said the U.N. audit could not detect all of it.

Nevertheless, he said that based on the official final tally of votes, the commission had a duty to declare a victor.

"The Independent Election Commission of Afghanistan declare Dr. Ashraf Ghani Ahmad as the president of Afghanistan," Nuristani said.

He did not give the final percentages and took no questions.