U.S. Defense Secretary Robert Gates said Saturday during his farewell trip to Afghanistan that success of the U.S. mission is paramount and the "most costly thing of all would be to fail."

Gates, who's retiring as Pentagon chief at month's end, flew to Afghanistan from a security conference in Asia to bid goodbye to U.S. troops and Afghan leaders.

Gates planned to meet with soldiers and Marines in eastern and southern Afghanistan. He also scheduled talks with Afghan President Hamid Karzai, who has been sharply critical in recent days of NATO airstrikes that have killed and wounded civilians.

Aides said it was Gates' 12th trip to Afghanistan since he became defense secretary in December 2006. Gates told reporters before arriving in Kabul that although the war has proved costly in blood and money, budget concerns should not cut short the drive to succeed.

President Barack Obama has pledged to begin withdrawing American troops in July, but no final decisions have been made on the size of that withdrawal or the pace of subsequent troop reductions.

Many in Congress are arguing for an early U.S. exit from Afghanistan, now that Al Qaeda leader Usama bin Laden has been killed. They say the cost of the conflict, at more than $100 billion a year, is unsustainable.

Gates disputed that reasoning.

"Success of the mission should override everything else because the most costly thing of all would be to fail," he said before flying to Afghanistan.

"Now that does not preclude adjustments in the mission or in the strategy. But ultimately the objective has to be success in the mission that has been set forth by the president," he said.

Obama has said the overarching goal is to defeat Al Qaeda and to enable the Afghan government to stand on its own.

Gates said before the visit that numerous factors are being weighed, including the impact of troop reductions on the willingness of NATO allies to sustain their troop commitments through 2014. That is the target date for Afghans to take the lead security role across the country.

"We don't want to precipitate a rush to the exits," Gates said.

Gates planned to meet Gen. David Petraeus, the top U.S. and NATO commander in Afghanistan. Petraeus is preparing recommendations on the July troop drawdown. He has been nominated to succeed Leon Panetta as CIA director; Panetta has been nominated to succeed Gates.

In a question-and-answer session with members of his audience after his speech at the Singapore conference, Gates said the United States and its allies fighting in Afghanistan will have to keep up military pressure on the Taliban in order to eventually reach a peace deal.

"The Taliban are probably a part of the political fabric of Afghanistan at this point," he said, so they could have a political role in the future. But to get to the point of a possible negotiated settlement, he said, the Taliban first will have to see their battlefield fortunes reversed. Gates said that "perhaps this winter" some form of political negotiation with the Taliban could begin, but only if NATO keeps up heavy military pressure to force the insurgents to the table.

"The prospects for a political settlement do not become real until the Taliban and our other adversaries begin to conclude that they cannot win militarily," Gates said.