BAGHDAD – A coalition of Shiite militias, regular Iraqi army units and Kurdish forces, backed by U.S. air power, on Sunday broke a long siege of Amerli, a town in northern Iraq that for weeks had been surrounded by Sunni extremists who threatened to slaughter thousands of Shiite residents.

The U.S. airstrikes on positions held by fighters of the Islamic State near Amerli, about 105 miles north of Baghdad, were carried out Saturday night in conjunction with airdrops of supplies to the town’s thousands of besieged residents.

The U.S. operation was supporting a ground offensive led by Shiite militia fighters, many of whom once fought fierce battles against American soldiers.

“ISIS militants have fled as our heroes in the Army and the volunteers are progressing at Amerli,” said Qassim Atta, the Iraqi military spokesman, according to a report on state television Sunday. ISIS is a former abbreviation for the Islamic State.

Security officials said Sunday that Amerli, a cluster of villages whose population is dominated by Shiite Turkmen who are considered infidels by the Islamic State, was not fully liberated but that the combined forces had cleared several villages from the militants. Fierce fighting in the area was continuing Sunday afternoon.

The operation around Amerli is the latest expansion of U.S. military operations in Iraq in recent weeks.

First, the U.S. military sent warplanes and drones to destroy millions of dollars of U.S. equipment that had been abandoned on the battlefield by the Iraqi army and seized by the Islamic State.

Now the United States has provided air support for several Iranian-backed Shiite militias that are leading the fight against the Islamic State in Ameril with the help of Kurdish peshmerga forces and Iraqi army units.

Both the United States and Iran, while not coordinating operations in Iraq, are nevertheless on the same side in the conflict against the Islamic State. The United States, though, has been reluctant to pursue military operations with Iraq’s Shiite militias. The militias have taken on a primary role in providing security in Baghdad and responding to the advances of the Islamic State; the Iraqi army, which had been financed and trained by the United States, has proved largely ineffective.

The Obama administration has tried to avoid being seen as taking sides in Iraq’s sectarian war because the militias are especially feared by Iraq’s Sunni population. The reality on the ground, however – the growing brutality of the Islamic State, the humanitarian crisis and the threat of a slaughter in Amerli – appeared to override those concerns.

The nature of the two sides in this war has become increasingly evident as the conflict has evolved. The Sunni extremists of the Islamic State have been rampaging through Iraq, beheading some of those whom it captures, carrying out large-scale massacres of Shiites and expelling hundreds of thousands of residents. The Shiite militias, which have in the past been responsible for abuses against Sunni civilians, are largely protecting their own communities and have proved essential to the defense of Baghdad.

Among the militias fighting for Amerli are Asaib Ahl al-Haq, perhaps the most experienced group, as well as Badr Corps, which is led by Hadi al-Ameri, the transportation minister, and a militia linked to the Shiite cleric Muqtada al-Sadr, who was one of the United States’ most implacable foes during the long American occupation. All those groups are supported by Iran.

Many officials said Sunday that it was Asaib, a militia that was a particularly fierce enemy of the United States as it was winding down its military role in Iraq in 2011, that has taken on the most prominent role in the fighting for Amerli, in Salahuddin province.

“I would like to thank the jihadists from Asaib Ahl al-Haq, as they are sacrificing their lives to save Amerli,” said Mahdi Taqi, a member of the regional council in Salahuddin province.

Taqi said Amerli, whose residents chose to defend their city against the Islamic State rather than flee as residents of other communities did in the face of the onslaught, had been partly liberated from the east side.

Other fighters were advancing toward Amerli from the north.

Karrar Ibrahim al-Asadi, an Asaib fighter in Suleiman Bek, a village to the north of Amerli where the Islamic State has been in control, said in an interview: “I have been here for 15 days. Today we have destroyed 40 armed vehicles and an entire convoy of ISIS. We will eliminate them all in the next few hours in Sulaiman Bek and once we do, only eight kilometers remain until we enter Amerli. I can see their black flag from here.”