President Karzai and Gen McKiernan addressed troops at the ceremony
The outgoing American general in charge of Nato forces in Afghanistan for the past 15 months says the war against the Taleban is "under-resourced".
Gen Dan McNeill was speaking before handing command of Nato's International Security Assistance Force (Isaf) to another American, Gen David McKiernan.
Isaf currently has 53,000 troops from 40 countries. But Gen McNeill said more manpower and equipment is needed.
The handover took place at an hour-long ceremony in the capital, Kabul.
It was attended by Afghan President Hamid Karzai, foreign ambassadors and a host of other dignitaries.
President Karzai warned the new general that his task would not be easy and that more lives would be lost before Afghanistan could stand on its own feet.
It is not clear how Gen McKiernan's command will differ from that of his predecessor.
But he said: "While today marks a transition in commanders, the
mission must continue without missing a beat.
foreign fighters, criminals and others who stand in the way
of that mission will be dealt with."
The BBC's Alastair Leithead in Kabul says Gen McNeill's reputation in Afghanistan has been for straight talking and keeping out of politics.
Gen McNeill says Nato has had successes in the east
But he had two strong messages as he prepared to handover control of Isaf to Gen McKiernan.
When he took over in February 2007 Isaf had 33,000 troops. Even though there are now 53,000 troops, Gen McNeill said that was still not enough.
"This is an under-resourced war and it needs more manoeuvre units, it needs more flying machines, it needs more intelligence, surveillance and recognisance apparatus," Gen McNeill said.
"I'm not just focused on the US sector, I'm talking about across the country."
He suggested that if counter-insurgency guidelines were strictly followed, 400,000 troops would be needed in Afghanistan.
Our correspondent says there have clearly been military inroads against the insurgency in the past 15 months.
A number of important Taleban commanders have been killed and the counter-insurgency strategy has developed.
Gen McNeill highlighted the east of the country as an example of success. However there has been an increase of attacks in the area, which he blamed on the situation in Pakistan.
Referring to the current peace talks between the Pakistani government and leading militants there, he said "there appears to be a lack of pressure right now" which had a knock-on effect on Afghanistan.
"You also know we keep a measurement of what occurs and you know of a time when there has been dialogue or peace deals, the incidents [of attacks in Afghanistan] have gone up."
The new commander of Isaf, Gen David McKiernan, oversaw the ground attack that toppled Saddam Hussein in Iraq.
His tour of duty comes at a time of increasing attacks on troops on the 40 nations making up the Nato force.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.