Afghanistan's first directly elected president, Hamid Karzai, has warned that his country must face down radical extremists and defeat the drug trade.
Hamid Karzai's election victory has handed him extra legitimacy
Speaking at his inauguration ceremony in the capital Kabul, Mr Karzai said Afghanistan has left a hard and dark past behind.
He said October's elections were a defeat for extremists, but warlords and drug traders all had to be disarmed.
Mr Karzai has been interim leader since the Taleban were ousted in 2001.
Among the 150 guests at the ceremony were US Vice-President Dick Cheney and US Defence Secretary Donald Rumsfeld.
Ordinary Afghans were urged to stay at home amid fears of attacks by Taleban and al-Qaeda fighters.
In an address following his swearing-in, Mr Karzai paid tribute to the resilience of his fellow Afghans and their willingness to work for a free, peaceful and prosperous future after decades of civil war.
"We have now left a hard and dark past behind us, and today we are opening a new chapter in our history in a spirit of friendship with the international community," he said.
"Our fight against terrorism is not yet over," Mr Karzai said.
"A decisive victory over terrorism requires serious and continuous co-operation at regional and international levels."
He urged sustained international aid and co-operation to defeat increasing links between extremists and drug-trafficking.
Speaking to reporters at Bagram airbase as he left Afghanistan late on Tuesday, the US defence secretary acknowledged the need for vigilance against a renascent Taleban threat.
"There are still groups, extremists, that would like to take this country back - the Taleban, the al-Qaeda - and use it for a base for terrorist activities around the world
as they did on 9/11.
"But it's not going to happen," he added.
Afghanistan is still riven by tribal differences, with hugely influential warlords such as Abdul Rashid Dostum controlling large swathes of the country.
Western governments also fear that a boom in opium farming is threatening to flood Europe with cheap heroin and turn Afghanistan into a virtual "narco-state".
Oath of allegiance
Earlier, at Kabul's presidential palace, Mr Karzai was sworn in as president after a children's choir sang the national anthem.
Mr Karzai - clad in a traditional green robe and a black lambskin hat - placed his right hand on a copy of the Koran and repeated an oath of allegiance read to him by chief justice Fazl Hadi Shinwari.
"I swear to obey and safeguard the provisions of the sacred religion of Islam, to observe the constitution and other laws of Afghanistan and supervise their implementation, and with the assistance of God and the support of the nation, to make great and sincere efforts for the happiness and progress of the people of Afghanistan."
The audience of Afghan politicians and foreign dignitaries in the capital broke into applause as Mr Karzai completed the oath.
He then swore in his two deputies, Ahmad Zia Massood and Karim Khalili, members of the country's two largest ethnic minorities.
Hours before Mr Karzai spoke, at least 10 people died after suspected Taleban fighters attacked military posts in Khost province near the Pakistan border, reports said.
A BBC Pashto service reporter saw the bodies of four suspected militants and two Afghan soldiers. US forces took away the bodies of four more attackers, locals said.
In the capital, US and Nato troops stepped up air and ground patrols for the swearing-in.
The inauguration comes three years after the US-led efforts to depose the Taleban regime following the 11 September 2001 attacks in New York and Washington.
The Taleban had given sanctuary to Osama Bin Laden and members of his al-Qaeda network, who are accused of carrying out the attacks.