WASHINGTON (CNN) -- The United States will not likely launch another regime-changing war "anytime soon," but American troops will remain in Iraq and Afghanistan for years, Defense Secretary Robert Gates said Monday.

Robert Gates says U.S. troops in Iraq will serve in advisory or counterterrorism capacities "for years to come."

Failure in either nation "would be a disastrous blow to our credibility, both among our friends and allies and among potential adversaries," Gates said.

Speaking at the National Defense University in Washington, Gates addressed President Bush's recent decision to pull 8,000 troops out of Iraq and send 4,500 troops to Afghanistan. Gates predicted even more troops would be sent to Afghanistan next year.

"Given its terrain, poverty, neighborhood and tragic history, Afghanistan in many ways poses an even more complex and difficult long-term challenge than Iraq -- one that, despite a large international effort, will require a significant American military and economic commitment for some time," Gates said. Watch how new Pakistani militias are taking on Taliban and warn U.S. »

But rather than solely tapping its military capabilities, Gates said the United States also will utilize "indirect approaches" that "prevent festering problems from turning into crises that require costly and controversial American military intervention."

Gates said not to expect troops to leave Iraq after the upcoming U.S. election.

"No matter who is elected president in November," he said, "there will continue to be some kind of American advisory and counterterrorism effort in Iraq for years to come."

During his lecture, Gates also touched on the Russia-Georgia conflict, U.S. military capacity and the U.S. war on terror, which he said will require at least some direct military force.

Don't Miss

"But we also understand that over the long term, we cannot kill or capture our way to success," he said. "Where possible, kinetic operations should be subordinate to measures to promote better governance, economic programs to spur development and efforts to address the grievances among the discontented from which the terrorists recruit." Watch a reality check from Iraq »

Though rogue nations and rising powers pose threats to the United States, the greatest threats to the homeland are terror networks that "find sanctuary within the borders of a weak nation and strength within the chaos of social breakdown," Gates said.

A terror attack on a U.S. city, he said, is "more likely to emanate from failing states than from aggressor states."

"In addition, there is the potentially toxic mix of rogue nations, terrorist groups, and nuclear, chemical or biological weapons," he said. "North Korea has built several bombs, and Iran seeks to join the nuclear club. North Korea is impoverished, literally starving, while Iran sits on a sea of oil. Both have primitive ground offensive capabilities and ballistic missile programs of increasing range. Both have a record of proliferation and ties to criminal groups or terrorist networks."

To combat these evolving threats, the U.S. military will need more than expensive high-tech weapons. It must adapt to "a blended, high-low mix of adversaries and types of conflict."

With ongoing operations in Iraq and Afghanistan, the U.S. military would have difficulties fighting "a major conventional ground war elsewhere on short notice," but it still wields enough firepower to "deter or punish aggression," Gates said, citing specifically the Korean Peninsula, Persian Gulf and Taiwan Strait.

However, the United States is "unlikely to repeat another Iraq or Afghanistan anytime soon -- that is, forced regime change followed by nation-building under fire," he said.

"What all these potential adversaries have in common -- from terrorist cells to rogue nations to rising powers -- is that they have learned over time that it is not wise to confront the United States directly on conventional military terms," he said.

Gates downplayed concerns that Russia has re-emerged as a threat to the United States, saying that Russia is not trying to "dominate the globe."

Russia's recent campaign against Georgia showed that "militaries do still matter," he said, but the crushing of "Georgia's tiny military" last month does not mean the United States should rearm for a Cold War.

"Remember that what's driving Russia is a desire to exorcise past humiliation and dominate their near abroad -- not an ideologically driven campaign to dominate the globe," Gates said.

While Russia's military has "vastly improved" since its decline in the last decade, it "remains a shadow of its Soviet predecessor" and Russia's demographics impede its rapid growth.

"Though Russia's recent air and naval forays into this hemisphere have grabbed headlines, it's also worth nothing that in the last 15 years, the Russian navy has launched only two new major warships," Gates said. "Russia does present serious challenges, but ones very different from the past."

Gates cited some shortcomings in U.S. military capacity, including aging fighter and refueling planes, and a ground force spread so thinly that it's unable to focus on specialties, such as the Army's field artillery corps or the Marines' amphibious operations.

"We must remedy this as soon as we can through growing the ground forces and increasing dwell time and opportunities for full spectrum training," he said.

But never underestimate U.S. military dominance, he said. Though it is engaged in two campaigns, the military still has plenty of man- and firepower compared with other militaries. A good example is the U.S. Navy, which has shrunk considerably since the Cold War but remains bigger than the 13 next-largest navies combined.

"No other navy has anything comparable to the reach or combat power of a single American Carrier Strike Group," he said.