Afghanistan inaugurates its first new president in a decade on Monday, swearing in technocrat Ashraf Ghani to head a power-sharing government just as the withdrawal of most foreign troops presents a crucial test.

The first democratic handover of power in Afghanistan's history has been far from smooth: the deal for a unity government was cobbled together only after months of deadlock over a vote in which both Ghani and opponent Abdullah Abdullah claimed victory.

The inauguration marks the end of an era with the departure of President Hamid Karzai, the only leader Afghans have known since a U.S.-led invasion in 2001 overthrew the Islamist Taliban that had given sanctuary to al Qaeda.

Already-tight security was heightened around the capital Kabul ahead of the inauguration for fear Talibaninsurgents might try to disrupt the ceremony or attack international dignitaries who flew in to attend.

Both foreign backers and Afghans hope that Ghani and Abdullah can put aside their acrimonious election rivalry and work to improve life in a country that has suffered war and poverty for decades.

"We expect both to fulfil the promises they made to the people," said unemployed Kabul resident Mohammad Sharif. "We, the people of Afghanistan, are monitoring their performance to see whether they can serve the people or not."

The new government inherits massive problems, including fighting an emboldened Taliban that in recent months has been launching ever more aggressive attacks as foreign troops draw down.

Ghani must also reset relations with the United States, which have soured in recent years under Karzai. One of Ghani's first acts as president is expected to be signing a bilateral security agreement to allow a small contingent of U.S. forces to remain to train and assist the new Afghan army and police.

Karzai has refused to sign it, but both Ghani and Abdullah are in favor of signing it promptly.

GOVERNMENT BROKE

The inauguration ceremony is expected to begin at about 10 a.m. (0530 GMT) at the vast presidential palace compound. Foreign dignitaries including Pakistani President Mamnoon Hussain and senior White Houseadviser John Podesta are due to attend.

Another early act for Ghani is expected to be appointing Abdullah as chief executive of the new government, an expanded post with powers similar to those of a prime minister that was created to break the election deadlock.

The new government will immediately face a fiscal crisis. Already heavily dependent on foreign aid, Kabul has asked the United States and other donors for $537 million to pay its bills until the end of the year.

A Finance Ministry official acknowledged over the weekend that the government is so broke that it has been forced to delay paying civil servants' salaries for October because the treasury does not have the $116 million needed.

Some hope that Ghani, a longtime World Bank official and former finance minister, will put his knowledge of international institutions and development to work in combating Afghanistan's tradition of corrupt and inefficient government.

A U.S.-trained anthropologist from Afghanistan's Pashtun ethnic group, Ghani spent almost a quarter of a century outside Afghanistan during its tumultuous decades of 1980s Soviet occupation, followed by civil war and Taliban rule.

After the Sept. 11 attacks, he returned to become a senior adviser to newly appointed leader Karzai.

Abdullah remained in Afghanistan during the years of war as a close confidant to the anti-Soviet and later anti-Taliban fighter Ahmad Shah Massoud, an ethnic Tajik commander who was assassinated in 2001.

If Ghani and Abdullah can work together well, they could help bridge longstanding ethnic and political divides in Afghanistan, although skeptics fear the coalition will inevitably be caught up in power struggles and rivalries between entrenched interests.