Iraqi forces retook most of the country's largest refinery from Islamic State on Saturday, officials said, reversing gains by the militants who seized parts of the sprawling complex in northern Iraq this week.
A spokesman for the US-led coalition fighting Islamic State said troops had recaptured all of Baiji refinery at 11:30 GMT, but officials in Salahuddin, the province where it is located, said there was still fighting around some facilities.
The insurgents attacked the refinery a week ago by blasting through the security perimeter around it and taking over several installations, including storage tanks, a technical institute and a distribution point.
The Baiji refinery produced around 175,000 barrels per day before it shut in June when Islamic State fighters seized it at the same time as the city of Mosul.
Iraqi forces retook it from militants in November but subsequently lost control again. A source in the military command for Salahuddin province said clashes continued on Saturday, with insurgents fighting the army's elite Golden Division and paramilitaries in southern and western parts of the refinery complex.
Raid Jubbouri, the governor of Salahuddin province, said Iraqi forces were in full control of the refinery "from a military perspective", but some insurgents remained hidden inside the complex.
Islamic State insurgents suffered a major defeat this month when Iraqi troops and Shi'ite paramilitaries routed them from the city of Tikrit, but struck back at Baiji and in the western province of Anbar.
Thousands of families have fled Anbar in recent days as Islamic State militants encroached on Ramadi and local officials warned the city was about to fall.
Two members of the Anbar provincial council and police Major Khalid al-Fahdawi who is stationed inside Ramadi said reinforcements were on the way and the city was no longer in immediate peril.
"The danger is still there, but the situation is better than yesterday," provincial council member Sabah Karhout told Reuters.