Afghanistan's rival presidential candidates on Sunday signed a deal to share power after months of turmoil over a disputed election that destabilized the nation at a crucial time as most foreign troops prepare to leave.

Ashraf Ghani, a former finance minister who will be named president, embraced rival Abdullah Abdullah after they signed the power-sharing agreement at a ceremony watched by outgoing President Hamid Karzai, and broadcast live from his palace.

The new administration faces huge challenges in fighting an emboldened Taliban-led insurgency and paying its bills amid plummeting tax revenue.