HEIDELBERG, Germany — Defense Secretary Robert Gates on Thursday questioned the commitment of some NATO allies to winning in Afghanistan, saying the outcome there is at "real risk" because some European nations are unwilling to provide enough troops and resources to the mission.

"In Afghanistan a handful of allies are paying the price and bearing the burdens," he told a conference of army leaders from 38 European nations organized by the chief of U.S. Army Europe.

"The failure to meet commitments puts the Afghan mission — and with it, the credibility of NATO — at real risk," he added in remarks that were notably critical of European governments that have been close security, political and economic partners of the United States for more than five decades.

He also said restrictions that some allies put on how and where their troops can operate in Afghanistan have unfairly burdened other coalition partners and "done real harm" to the overall war effort.

The United States has 26,000 troops in Afghanistan and the non-U.S. total is 23,000. For the past year, NATO has had overall command of the forces, other than 13,000 U.S. troops doing counterterrorism missions. In that period, violence led by the Taliban has increased, although Gates said NATO should take credit for blunting a spring offensive by the Taliban, especially in the south.

Gates spoke hours after leaving a two-day meeting of NATO defense ministers in Noordwijk, the Netherlands, where U.S.-led efforts to provide sufficient troops for the Afghanistan mission was a central topic.

His audience in Heidelberg included army chiefs from most NATO countries, plus their counterparts from other European nations. It was the first time an American secretary of defense had addressed the group, known as the Conference of European Armies. It also was the first time since the annual gatherings began in 1991 that reporters were allowed to cover part of the proceedings.

Gates said before the NATO session that he was not satisfied with the allies' efforts. In Heidelberg he was more direct and specific, telling the army chiefs that the stakes in Afghanistan are great.

"If an alliance of the world's greatest democracies cannot summon the will to get the job done in a mission that we agree is morally just and vital to our security," he told the European army generals, "then our citizens may begin to question both the worth of the mission and the utility of the 60-year-old trans-Atlantic security project itself," referring to NATO, which was created in 1949.

He cited one example that has been a particular irritant to Pentagon officials — the allies' failure to provide a small number of helicopters to perform a mission deemed essential by the overall commander in Afghanistan. In the meantime, the U.S. military has bridged that gap, though reluctantly.

"Consider that earlier this year the U.S. extended its aviation bridging force in Afghanistan — in Kandahar — because the mightiest and wealthiest military alliance in the history of the world was unable to produce 16 helicopters needed by the ISAF commander — 16," Gates said. He used the acronym for the International Security Assistance Force, which is the NATO-led group that commands coalition forces.

His remarks drew little reaction from the generals in his audience, who applauded politely when he finished. They chuckled when he recalled being surprised to find himself at a topless beach on the French island of Guadeloupe in 1978 as a member of an advance team sent from Washington to plan a NATO summit.

"Luckily, the Guadeloupe summit later went off without a problem, but I must admit, my notes from that seaside meeting were quite incomplete due to nearby distractions," he said with a laugh.

After his Heidelberg stop Gates headed back to Washington, completing a five-day trip that also took him to Ukraine and the Czech Republic.