Defense Secretary Ashton B. Carter during a recent visit to Jerusalem. The visit was part of his tour of several countries in the Middle East this week, including Iraq, where he arrived Thursday. (Abir Sultan/European Pressphoto Agency)

U.S.-trained Iraqi soldiers are preparing for an offensive against the Islamic State in the Iraqi city of Ramadi, defense officials said Thursday, in a key test of the Obama administration’s strategy for defeating the militant group.

About 3,000 U.S.-trained soldiers have taken positions around Ramadi in the past few days, the first time that Iraqi army troops trained by American advisers over the past year have been deployed for an offensive against the Islamic State.

Army Col. Steve Warren, a Pentagon spokesman, said the deployment of two U.S.-trained brigades, part of a larger Iraqi force around Ramadi, was significant because the troops were well trained and better equipped than many other Iraqi army units. He said the brigades advanced about four miles Wednesday. “We’ve already seen progress,” he told reporters in Baghdad.

News of the developments came as Defense Secretary Ashton B. Carter made his first trip to Baghdad since assuming his post in February.

The brief visit by Carter, who has openly questioned Iraqi forces’ will to fight, aimed to assess the Baghdad government’s efforts to improve the state security forces and recruit Iraq’s minority Sunnis, whose support U.S. officials view as key to defeating the Islamic State.

American officials hope that fielding the U.S.-trained troops around Ramadi will yield the first signs that the Iraqi army is regaining its footing a year after it partially collapsed in the face of the Islamic State’s advances. Until now, army units trained by the United States since last year have conducted only defensive operations.

In coming months, the Obama administration will have to decide whether it will send additional U.S. troops to Iraq or deploy Americans closer to the front lines to ensure that Iraqi forces can accelerate their fitful progress against the militant group, also known as ISIS, ISIL and Daesh.

Carter, speaking at the end of a meeting with Prime Minister Haider al-Abadi in Baghdad’s Green Zone, lauded the Iraqi leader’s efforts to foster inter-sectarian cooperation since becoming premier last year. The Islamic State has drawn the support of many Sunnis who feel sidelined by the Shiite-led central government.

“To defeat Daesh, we need capable ground forces that we can enable and support, and we will. And getting those forces, in turn, requires inclusive governance,” Carter said.

The U.S. defense chief also held talks with his Iraqi counterpart, Khaled al-Obeidi, and leaders from largely Sunni provinces such as Anbar, whose capital city is Ramadi.

Carter also visited the Iraqi Counterterrorism Service Academy, where U.S. troops are training and advising elite Iraqi forces. The government has relied heavily on these counterterrorism forces in operations against the Islamic State over the past 18 months.

At the training site, Carter watched soldiers — in all-black uniforms and some with black masks — perform shooting drills. The academy’s commander, Maj. Gen. Falah al-Mohamedawi, thanked Carter for U.S. support in the development of Iraq’s counterterrorism capabilities.

“God willing, together we will defeat Daesh,” Mohamedawi told Carter.

“Yes, we will,” Carter replied.

In contrast to the elite counterterrorism forces, Iraq’s army has struggled to overcome poor morale, chronic corruption and shortcomings in logistics and other key military systems. The army’s weakness was a major factor drawing the Obama administration back into military operations in the country in the past year.

The United States has about 3,500 troops on the ground in Iraq involved in advisory, training and other support functions.

U.S. military officials say that more than 5,000 Iraqi soldiers, police officers and counterterrorism troops are working to isolate Ramadi, whose fall to the Islamic State in May dealt a blow to efforts to expel the group from Iraq.

Warren, the Pentagon spokesman, said this week that the Iraqi forces around Ramadi were seeking to “place a noose around the city and isolate it” from militants elsewhere. The Ramadi offensive could begin as soon as “several weeks” from now, he said. The Islamic State is estimated to have 1,000 to 2,000 fighters in the city.

In a sign of the Iraqi government’s continued reliance on Shiite paramilitary forces, the preparatory efforts around Ramadi have been complemented by similar operations by Shiite militias and volunteer forces around the nearby city of Fallujah, also under Islamic State control. But Warren said militias would not take part in the Ramadi operation, which would be supported by U.S. air power.

Since last summer, U.S. and allied aircraft have conducted thousands of strikes on Islamic State targets in Iraq and Syria. American officials have said that the fight against the militant group will stretch well beyond the end of President Obama’s second term.

Warren also said that at least 500 Sunni tribal fighters trained by the Iraqi government — a feat that U.S. officials consider a step toward expanding Shiite-Sunni cooperation — are expected to take part in the Ramadi operation.

The Pentagon has said that Iraqi forces, under U.S. guidance, have trained about 1,800 Sunni tribal fighters at the Taqqadum air base, about 40 miles west of Baghdad. Those fighters have undergone a week’s worth of training and are receiving small arms and basic equipment such as radios.

Read more:

Carter vows to help Saudi Arabia contain Iran’s regional ambitions

Disagreement over Iran deal hangs over Netanyahu’s meeting with Carter

Carter, Netanyahu call it a day after discussing Iran deal