Iraqi troops and Shiite militiamen have broken through to end a siege by Islamic State (IS) militants on the town of Amerli.
The town had been surrounded by militants for more than two months, leaving as many as 15,000 Shiite Turkmen trapped and short of food and water.
Over the weekend an international effort including Australian, British and United States forces dropped humanitarian aid to residents trapped in the town, while US warplanes carried out air strikes on IS positions.
Amerli mayor Adel al-Bayati said troops backed by Shiite militias defeated IS fighters to the east of the town, averting a feared massacre if the town had fallen.
"Security forces and militia fighters are inside Amerli now after breaking the siege and that will definitely relieve the suffering of residents," he said.
The town, in Salaheddin province north of Baghdad, had been entirely cut off from the rest of government-held territory since fighters spearheaded by IS swept through much of the rest of the province in a lightning offensive in early June, the ABC reports.
A military spokesperson described Amerli as a launching pad to retake the northern province of Salahuddin, including its capital, which was captured by IS in June.
"The next step will be holding the ground tightly and liberating all the areas which link Amerli to Salahuddin," he said on state television.
While Kurdish fighters, backed by US air strikes, had beat back IS after losing terrain in August, the collection of Shiite security forces and militias had yet to score a significant military win.
Armed civilians of Amerli had managed to fend off attacks by IS fighters who regard the Turkmen population as apostates and residents have expressed relief after the siege was broken.
Fighting continued elsewhere in Iraq. In the western city of Ramadi, where Iraqi forces have been battling Sunni groups dominated by IS since January, a suicide bomber detonated an explosives-packed Humvee military vehicle, according to two police officers and a medical official.
The blast, targeting an unfinished nine-floor building, killed 22 security personnel and 15 civilians. The building, used by security personnel, was in the centre of Ramadi in western Anbar province.