United States Defence Secretary Robert Gates, in Pakistan for talks on how to defeat the Taliban, said on Monday the United States would not repeat the mistake of letting extremists take control of Afghanistan.
Gates met with President Pervez Musharraf following four days of meetings in Spain and Germany focused mainly on the war in Afghanistan.
Gates said the United States had absorbed the lessons of the 1980s and 1990s, when the United States left Afghanistan to descend into chaos after covertly supporting an Islamic jihad, or holy war, to end Soviet occupation of the country.
"After the Soviets left, the United States made a mistake. We neglected Afghanistan and extremism took control of that country," Gates told a news conference at the Chaklala military air base in the garrison city of Rawalpindi.
"The United States paid a price for that on September 11, 2001," Gates said, referring to attacks on the United States by Al-Qaeda, whose leader was harboured by the Taliban.
"We won't make that mistake again."
Gates' visit came as Musharraf faced mounting pressure to halt the flow of Taliban fighters across the border with Afghanistan.
Last year was Afghanistan's bloodiest since the US-led invasion in 2001 and the Taliban has promised a spring offensive of thousands of suicide bombers.
Pakistan has been important in the resurgence of the Taliban, which has used border areas as safe havens and recruited from Afghan refugee camps.
US military officials also say the Afghan insurgency's command operations came from the Pakistani side of the border and that training, financing, indoctrination, regeneration and other support activities were taking place there.
"We can't be successful unless Pakistan is part of the equation in eliminating this insurgency," said one NATO official ahead of Gates' trip.
While Islamabad agrees the refugee camps on its side of the border have become robust recruiting grounds for the Taliban, Pakistani officials reject blame for the rising violence in Afghanistan.
Musharraf has refused to take sole responsibility for the border and said the Taliban is Afghanistan's problem.
Pakistan's foreign minister called on Saturday for more help and less rhetoric from the United States to stop the flow of Taliban militants.
"Simply making a rhetorical appeal — stop extremism — if it were that simple it would have been resolved long ago in Palestine, in Lebanon and Iraq and in Afghanistan.
Obviously it's more complicated," Foreign Minister Khursheed Mehmood Kasuri told the agency at a security meeting in Munich on Saturday.