Defense Secretary Ashton B. Carter. (Mandel Ngan/AFP/Getty Images)

Defense Secretary Ashton B. Carter warned that Iraqi troops will not be able to defeat the Islamic State until they develop a “will to fight,” reflecting the deep level of concern and frustration inside some quarters of the Obama administration in the wake of the Iraqi military’s collapse in Ramadi last week.

His comments, in an interview that aired Sunday, came after fighters with the Islamic State, which had appeared to be retreating in parts of Iraq, swept through the western Iraqi city of Ramadi and were gaining ground in Syria.

President Obama has described the losses as a “tactical setback” and said that the administration’s overall strategy in Iraq and Syria would not change. Carter’s comments, though, suggested deeper problems with Iraqi forces. His remarks about the recent Iraqi defeats in Ramadi, a city where scores of U.S. troops were killed during the Iraq war, carried added gravity because they came over the Memorial Day weekend.

“What apparently happened was that the Iraqi forces just showed no will to fight,” Carter said in an interview that aired Sunday on CNN’s “State of the Union.” “They were not outnumbered, but in fact, they vastly outnumbered the opposing force. And yet they failed to fight.”

Iraqi government forces in the Jurf al-Sakher area, south of Baghdad, on May 24. (Haidar Hamdani/AFP/Getty Images)

U.S. officials have been saying for several months that U.S. airstrikes were degrading Islamic State fighters in Iraq and that the radical Sunni group, under pressure from Iraqi forces, had lost as much as 25 percent of the territory that it gained during its blitzkrieg last year. A large offensive involving Iraqi army forces, Sunni tribal fighters and American airstrikes was supposed to begin soon in western Iraq’s Anbar province, where Ramadi is the provincial capital.

The unexpected collapse of Iraqi forces in Ramadi, including elite counterterrorism troops from Iraq’s Golden Division, suggests that the Iraqi forces may be weaker than many in the U.S. government had thought. The recent battlefield setbacks also point to a broader challenge facing the Obama administration’s campaign against the Islamic State throughout the Middle East.

The president has insisted that only local ground forces, bolstered by U.S. training and air power, can defeat Islamic State fighters who have gained ground and new recruits in Yemen, Libya, Syria and Iraq.

But finding local partners, especially Sunnis, in a region that is being torn apart by unprecedented levels of sectarian fighting has proved difficult.

“The really important question moving forward is: How do we find effective partners — not just in Iraq but in Syria and in Yemen and in Libya — that we can work with,” Obama said in a recent interview with the Atlantic magazine. “How do we create the . . . atmosphere in which people across sectarian lines are willing to compromise?”

Those questions have proved particularly vexing in Iraq, where Sunni tribesmen have been largely unwilling to battle the Islamic State on behalf of a Shiite-dominated government in Baghdad that they think is out to oppress them. Sen. John McCain (R-Ariz.) said that more support from the U.S. military, in the form of additional U.S. Special Operations troops who would accompany Iraqi troops into battle, could bolster the will of the Iraqi ground forces.

Front-line combat advisers, who would be at greater risk of death or injury from enemy fire than current American trainers, could help strengthen the resolve of untested Iraqi troops, a senior U.S. official said. “We call it the steel rod up the backbone,” said the official, who was not authorized to speak to the media and commented on the condition of anonymity. “It is a remarkable thing to see.”

Special Operations advisers could also direct airstrikes from American warplanes, improving their accuracy and effectiveness. On Sunday, McCain said that 75 percent of U.S. air combat missions in Iraq and Syria return to base without having fired a weapon or dropped a bomb. “It’s because we don’t have somebody on the ground who can identify a . . . moving target,” McCain said on CBS’s “Face the Nation.” “We need to have forward air controllers. We need to have Special Forces.”

One possibility being considered is training Iraqi troops to act as spotters. But calling in airstrikes is a highly technical skill, and it’s not clear that the U.S. military could train enough Iraqis in the coming months and years.

Obama administration officials have suggested that more U.S. airstrikes would not necessarily change the performance of Iraqi troops on the ground. “Airstrikes are effective, but neither they nor really anything we do can substitute for the Iraqi forces’ will to fight. They’re the ones who have to beat ISIL and keep them beaten,” Carter said, using a common acronym for the Islamic State. In particular, Carter said that the Sunni tribes in western Iraq, whose populations were initially welcoming of the Islamic State, must do more.

Iraqi politicians hit back at Carter’s claims Sunday, and fighters who fled Ramadi said that more U.S. airstrikes would have enabled them to keep control of the city.

“What the Americans are saying is delusional and not true. They want to make the Iraqi army look weak as a justification to invade Iraq again,” said Hakim al-Zamili, head of the Iraqi parliament’s defense and security committee and a Shiite militia commander. “Yes, there was a setback in Ramadi, but it was only a setback.”

Iraqi forces have been fighting pitched battles in Ramadi since early last year, when Islamic State fighters briefly seized the city and also took control of Fallujah, 30 miles east.

Forces from Iraq’s Golden Division were among those that capitulated in the face of the multi-pronged attack last week, but their commanders had complained that they were severely overstretched by fights on several fronts.

The Obama administration said recently that it is rushing as many as 2,000 shoulder-fired ­antitank weapons to Iraqi units. It is also pushing the Iraqi government, which has been reluctant to ship arms to Sunni tribal fighters, to speed up the weapons shipments. Recently, U.S. officials said that they had negotiated a new deal with Iraqi Prime Minister Haider al-Abadi to streamline the shipment of weapons to tribal fighters who have said they are not getting support from Baghdad.

Omar Shehan al-Alwani, a tribal fighter, said he bought bullets with his own money.

“The Iraqi government didn’t do anything to help us,” he said. “If only the coalition had carried out more. We withstood all this time thanks to our personal ­efforts.”

Fighters said they were prepared to continue battling but described a breakdown in the chain of command and a lack of coordination among different parts of the security forces.

“The reason for the fall of the city was the security commanders,” said Maj. Omar Khamis al-Dahl, a police officer from Ramadi. “They are not organized. They don’t know how to coordinate with each other.”

More U.S.-led airstrikes would have made a significant difference, he said.

“The coalition had a few strikes, and they were very accurate and helped us a lot,” he said. “But we’d ask for more strikes, and nothing would happen. There were many times that the coalition was in the sky, but they didn’t do anything. . . . If there were 20 airstrikes a day, none of this would have happened.”

Mustafa Salim in Baghdad and Vanessa Williams in Washington contributed to this report.