Iraqi government forces retook a military base in Ramadi Sunday and were close to retaking the entire city, which is located about 75 miles from Baghdad and has been controlled by the terror organization Islamic State group since May. The siege of the western city began several weeks ago and was close to completion Sunday, according to a local authority.

“By controlling the complex, this means that they have been defeated in Ramadi," said Sabah al-Numani, a government spokesperson close to the military action in Ramadi, Reuters reported. "The next step is to clear pockets that could exist here or there in the city," he said.

The loss of the government compound in Ramadi was seen as an embarrassing defeat for the Iraqi military when ISIS took over the base and several surrounding neighborhoods in May. Iraqi forces have been steadily recapturing areas around the base throughout the past several weeks as they moved to surround the compound and oust the last of the militants.

ISIS emerged from the chaos of an ongoing civil war in Syria as an anti-government faction fighting Syrian President Bashar Assad. The militant group expanded and has looked not only to depose Assad but also to impose Islamic law across vast swathes of Iraq and Syria. The group had taken over nearly one-third of Iraq since invading in 2014.

The mission in Ramadi took several weeks to complete, as the Iraqi military officials said they feared ISIS militants had booby-trapped the compound with explosives. By Sunday evening local time all militants had been cleared from the compound while the Iraqi military swept the surrounding area.

"All Daesh fighters have left. There is no resistance," al-Numani told Agence France-Presse Sunday, using the Arabic acronym for ISIS. Because Iraqi forces still needed to clear the area of explosives, authorities had not yet declared victory. But people in Ramadi and Baghdad had already begun to celebrate in the streets.