Smoke rises from the oil refinery near Baiji on Oct. 14, 2015, amid fierce fighting as Iraqi forces pushed to retake the facility from Islamic State militants. (Reuters)

After more than a year of intense clashes, Iraqi forces claim to have wrested control of their country’s largest oil refinery from Islamic State militants, though little remains of the facility that once processed about 175,000 barrels a day.

Black smoke choked the sky and hulking processing equipment lay twisted and charred as Shiite militia leaders allied with the Baghdad government took journalists on a tour of the refinery near Baiji on Wednesday, declaring it fully under their control. Meanwhile, Iraqi security commanders said they were making gains in the town, putting the Islamic State militants on the defensive.

The assertion of victory at the Baiji oil complex is not the first such claim by Iraqi forces, however. They have made the same proclamation several times before, only to eventually lose their grip over the facility. Mortar rounds and gunfire could still be heard in the vicinity Wednesday.

The refinery has been a deadly quagmire for Iraqi forces since the Islamic State seized control of most of the vast complex in June 2014, shortly after capturing the northern city of Mosul. Security forces that were holed up in parts of the facility during the protracted fighting faced a relentless campaign of suicide bombings, and the United States airdropped supplies to help the trapped troops.

Map: What a year of Islamic State terror looks like

The facility is in some ways a hollow prize, with officials saying it could take years to become operational — if it is ever repaired. But the area is strategically important for both sides, and its capture puts Iraqi forces one step closer to Mosul, the largest city in northern Iraq and the Islamic State’s main stronghold in the country.

“Baiji has been a difficult entanglement for our forces since the fall of Mosul,” said Abu Mahdi al-Muhandis, leader of Iraq’s “popular mobilization units,” as the loose affiliations of Shiite fighters and militiamen allied with the government are known. “But now we have finished the Baiji refinery entanglement forever.”

The fight for the refinery was initially waged by Iraq’s special forces supported by U.S.-led coalition airstrikes, but the involvement of militia fighters gradually increased.

Members of Kitaeb Hezbollah, Asaib ahl al-Haq and the Badr Organization — Shiite militias close to Iran — were at the refinery Wednesday, along with Iraqi federal police and special forces.

The advance follows a visit by Prime Minister Haider al-Abadi to the area this week, when he announced a renewed offensive.

Muhandis dismissed the role of the U.S.-led coalition, describing the gains as a “purely Iraqi victory.” He said he had requested that the coalition airstrikes be called off, alleging a lack of coordination with his fighters on the ground.

“It is madness to fight on the ground and there is an air force in the sky and you don’t know how it will bomb,” said Muhandis, who is deemed a terrorist by the United States for his role in attacks on U.S. forces in Iraq.But coalition jets have continued to carry out airstrikes; the coalition reported two in the Baiji area Wednesday.

Sabah Noori, a spokesman for Iraq’s special forces, said some militants remain trapped on the northern side of the refinery complex, surrounded by pro-government fighters. The Islamic State commander in the area, known as Abu Suleiman al-Filistini, was killed Wednesday, Noori said.

Burned tanks and military vehicles lined the roads Wednesday, along with at least half a dozen corpses of Islamic State fighters.

The Islamic State has used the Baiji fight as a way to pin down government forces and distract them from larger battles, said Aymenn al-Tamimi, a fellow at the Middle East Forum who specializes in extremist groups.

“What matters is to keep government forces bogged down there,” he said. “And it has been a success for [the Islamic State] in that regard.”

Morris reported from Beirut.

Read more:

Pro-Iran militias’ success in Iraq could undermine U.S.

Petraeus: The Islamic State isn’t our biggest problem in Iraq