Secretary of State Condoleezza Rice promised victory over a resurgent Taliban during an upbeat visit to Afghanistan on Wednesday and called the country's embattled president one of the most respected leaders in the world.

Rice acknowledged that the rise in violence in Afghanistan in recent months is a concern for the United States and the U.S.-backed government of President Hamid Karzai.

But she said democratic gains in the country in the nearly five years since the fall of the Taliban will not erased.

"That Afghanistan has enemies is not a surprise to anyone," Rice said following meetings with Karzai and with military commanders. All her meetings were held behind heavy fortifications.

Rice said the United States is committed to Afghanistan for the long haul. "We are not going to tire, we are not going to leave," she declared.

Karzai said optimism about his country's gains does not mean he is blind to its challenges, among them corruption and the drug trade.

Terrorists "are trying to attack us where they can," Karzai said. "When we speak of success, it doesn't mean that we forget the problems."

A clearly frustrated Karzai criticized the coalition's anti-terror campaign last Thursday, deploring the deaths of hundreds of Afghans and appealing for more help for his government.

Karzai did not repeat that criticism with Rice by his side, and Rice gave little sign that she is worried about the direction of the fight against terror even while acknowledging the scope of the challenge.

"This is an international force that is determined to try to undermine the aspirations of free people and they are not going to win," Rice said.

"We have to realize we that we have a common enemy. We can all do more. We can all work harder we all need to constantly assess our strategy, look at our tactics, make certain that we are responding to their change in tactics, because this is a thinking enemy."

After a few hours in Afghanistan, Rice was headed to Moscow for a meeting with counterparts from the Group of Eight industrialized nations in which the topic was expected to be Iran's disputed nuclear program.

She had been in Pakistan on Tuesday for meetings with President Gen. Pervez Musharraf and other Pakistani officials.

While there, she heard Pakistan's military government challenge neighboring Afghanistan to identify the terror hideouts that Afghanistan claims exist in Pakistan.

"Our view is that we have two good friends and two fierce fighters in the war on terror," Rice said following meetings with Musharraf and Foreign Minister Khursheed Kasuri.

Musharraf became an unlikely ally of the Bush administration following the Sept. 11, 2001, attacks when he pledged cooperation against terrorists who traveled easily between Pakistan and the lawless Taliban stronghold in Afghanistan.

Karzai has criticized Pakistan for not doing enough to go after terrorists along the mountainous border between the two nations.

The deadliest fighting in Afghanistan since the fall of the Taliban in 2001 has killed more than 500 people, mostly militants, since mid-May and raised fears of a Taliban resurgence.

Afghan officials have said the Taliban is making an all-out push to scare Britain, Canada, the Netherlands and Romania from deploying some 6,000 troops to the region.

Outside Kabul, there is little visible evidence of improvements in infrastructure or services since the Taliban regime was ousted.

That has allowed forces loyal to the hard-line Islamic regime to regain strength and sympathy in their former strongholds in the poorer southern provinces of Uruzgan, Helmand, Zabul and Kandahar.

The Taliban also is being fueled by the return of a flourishing drug trade. Afghanistan produces 90 percent of the world's heroin supply with its poppy crop, and the profits of drug trafficking are helping fund the militants.