Ashraf Ghani, a one-time US-based academic, was sworn in as the new president of Afghanistan on Monday, taking power as NATO troops end their 13-year war without defeating the fierce Taliban insurgency.
A small bomb attached to a cart exploded in east Kabul early in the morning, injuring no one, police said, with much of the city under a security lockdown due to the threat of militant attacks.
Afghan dignitaries gathered for the ceremony in the presidential palace as helicopters buzzed overhead ferrying in foreign guests.
The event marked the country's first democratic transfer of power -- a benchmark seen by international donors as a key legacy of the costly military and civilian intervention since the fall of the Taliban regime in 2001.
"I will abide by the constitution and other laws and protect their implementation," Ghani said in an oath administered by the chief justice.
Ghani succeeds President Hamid Karzai after a bitter three-month standoff over disputed election results that fuelled the insurgency and worsened Afghanistan's dire economic outlook.
Both Ghani and his poll rival Abdullah Abdullah claimed to have won the fraud-tainted June 14 election, plunging Afghanistan into a crisis that threatened to trigger nationwide unrest.
Under heavy pressure from the US and UN, the two candidates eventually agreed to form a "national unity government", and Ghani was declared president after an audit of nearly eight million ballot papers.
Abdullah was also sworn in on Monday as chief executive, a new role similar to a prime minister, in a government structure far different to Karzai's all-powerful presidency.
John Podesta, counselor to President Barack Obama, led a 10-strong US delegation, with President Mamnoon Hussain representing Pakistan and Vice President Hamid Ansari travelling from India.
Many other countries, including Britain and France, were represented only by their ambassadors in Kabul, while China sent Yin Weimin, minister of human resources.
On the eve of the swearing-in, another small bomb hidden in a military vehicle exploded outside the presidential palace complex, injuring the driver.
"We made a lot of effort to bring about a long-lasting peace, but unfortunately our hopes did not fully materialise, but I should say that peace will surely come," Karzai said in an emotional farewell speech to the nation late Sunday.
"I will transfer government responsibilities to the elected president tomorrow and will start my new life as a citizen of Afghanistan.
"I will strongly support the new president, the government and the constitution and will be at their service."
Both Ghani and Abdullah are moderate, pro-Western leaders who have vowed to push ahead with the patchy social and infrastructure progress since 2001, but the country still faces a major threat from Taliban militants.
Large-scale insurgent offensives have been launched in several provinces in recent months, with the Afghan army and police struggling to recapture lost ground.
NATO operations have scaled back rapidly and its combat mission will finish at the end of this year.
Only 33 NATO bases are still active, down from a peak of 800 -- leaving local security forces to battle the Taliban with less and less help.
Monday's inauguration opened the way for the new government to sign an agreement allowing 12,500 US-led troops to remain into 2015 on a mission to support and train the police and army.
Ghani promised immediately to reverse Karzai's decision not to sign the deal, and the document is due to be inked on Tuesday.
"The political transition was a success and all those who predicted it was not possible were proven wrong," Ghani said last week.
"We are one people, one country, and there should not be any doubts in our national unity."
Final results revealed Ghani beat Abdullah 55 to 45 percent in the run-off vote, though the UN said the election had been affected "significant fraud".
Karzai, who ruled since the fall of the Taliban in 2001, was constitutionally barred from running for a third term in office.