Iraqi security forces pushed Islamic State fighters from the western city of Hit on Monday.

BAGHDAD (Agencies) - Iraqi security forces pushed Islamic State fighters from the western city of Hit on Monday, raising the Iraqi flag over the local municipal building and dealing another blow to the group’s weakening self-proclaimed caliphate, authorities here said.

Iraq’s Counter-Terrorism Service and Joint Operations Command confirmed that the government was in control of the center of the city, which is located on the Euphrates River in Anbar province, about 100 miles west of Baghdad.

“I am now inside the government [headquarters] in Hit,” Lt. Gen. Abdul Ghani al-Assadi, commander of Iraq’s counterterrorism forces, said by telephone. “We defused the booby traps and raised the Iraqi flag. Now I can say, after we’ve taken this building, that Hit is completely liberated.”

He said his forces still needed to clear at least a few neighborhoods where fighting had flared, but he insisted that the occupiers were fleeing.

Pro-government forces had been fighting since March to retake Hit, which was overrun by Islamic State militants in October 2014.

Assadi said more than 11,000 people were evacuated from Hit but that there were still civilians in the city.

The jihadists used improvised explosives and car bombs to slow the advance of Iraqi forces but are now “fleeing across the river,” Assadi said.

“Their bodies are in the streets,” Assadi said of the extremists killed in the offensive.

He did not say how many Iraqi troops had died in the assault. Government forces were detaining male residents of the city to conduct security checks and verify their status as civilians.

The operation in Hit is part of a wider government offensive in the western part of Anbar to dislodge the jihadists from key strongholds. U.S. forces are also stationed at the Ain al-Asad air base in Anbar, where they are training Iraqi troops. Iraqi forces recently recaptured the town of Kubbaisa, also in the province. In December, the government retook the Anbar provincial capital, Ramadi, which had been seized in a dramatic Islamic State offensive last spring.

The United States and Iraq, as well as Syrian government forces and rebels, have all sought to rout the jihadists from some of their most crucial strongholds. But the extremists are fighting back.

On Monday, Islamic State militants recaptured from Syrian rebels a key town on Syria’s border with Turkey, activists said, just days after the extremists were driven out by the rebels with the help of U.S. and Turkish strikes.

The rebels, fighting under the banner of the Free Syrian Army, had taken the town of Rai, just two miles from the Turkish border, from the Islamic State on Thursday. The operation was hailed as a boost for U.S. and Turkish efforts to oust the Islamic State from Syrian territory along Turkey’s frontier.

Farther west along the Syrian-Turkish border, the Turkish army shelled targets in northern Syria on Monday in retaliation for rocket fire that hit the Turkish town of Kilis, wounding at least four people, Turkey’s state-run Anadolu news agency reported. It said five rockets were fired into Turkey from Syria, but it was not immediately clear which group was responsible.

In March, two Turks, including a 4-year-old boy, were reported killed by rockets fired from Syrian territory controlled by the Islamic State. Last week, two people were wounded when rockets landed near a park in Kilis.

In the Rai area, jihadists “managed to infiltrate” rebel front lines Monday, routing the Free Syrian Army fighters from the area, the Islamic State said in a statement posted online. The militants also claimed to have captured two antiaircraft guns and stockpiles of weapons left behind by the rebels.

The Syrian rebels had “gathered on the orders of their masters, the Americans and the Turks, and with the support of [U.S. and Turkish] airplanes and artillery, the enemies of God controlled the town of al-Rai,” the Islamic State statement said.

“Then, the soldiers of the caliphate — with help only from God — managed to infiltrate the front lines” in Rai, the statement said. “God put fear into their hearts” and forced the rebels to flee, it said.