BAGHDAD - Government forces appeared close to capturing the capital of Iraq's largest province from the Islamic State on Monday, dealing a potentially significant blow to the militant group as it loses territory in both Iraq and Syria.

Soldiers and counterterrorism troops stormed into a sprawling government facility in Ramadi, driving the militants out of the area and effectively ending their seven-month occupation of the city, Iraqi officials said.

Television images showed the troops celebrating after their advance, which was aided by airstrikes from a U.S.-led coalition, by raising the Iraqi flag over the compound and slaughtering sheep inside of it.

The compound's capture was more symbolic than strategic, but its change of hands appeared to be the decisive blow to the militant group's hold on the city. Now, government forces appear poised to press their offensive: Prime Minister Haider al-Abadi, in a statement congratulating his forces for "defeating" the Islamic State in Ramadi, vowed to take the fight to the group in the country's second-largest city.

"We are coming to liberate Mosul," Abadi said.

The Islamic State shocked Iraqis in May when it captured Ramadi, capital of Anbar province. Losing the city would represent one of the most dramatic setbacks suffered by the group since its lightning assault across Iraq in June 2014.

"Daesh are running away now, and all the city is under our control," said Maj. Gen. Hadi Rzaig, head of the Anbar police force. Daesh is the Arabic acronym for the Islamic State, which is also known as ISIS and ISIL.

Secretary of State John Kerry commended Iraq's government and military for their fight "to return the capital of Anbar province back to the Iraqi people."

"While Ramadi is not yet fully secure and additional parts of the city still must be retaken, Iraq's national flag now flies above the provincial government center and enemy forces have suffered a major defeat," he said in a statement.