Turkey-backed Syrian opposition fighters advance on the city of al-Bab on Feb. 22. (Maan al-Shanan/AFP/Getty Images)

Turkish-backed rebels seized the Syrian town of al-Bab from Islamic State militants Thursday, ending a grinding offensive to push the extremist group from one of its final strongholds.

Launched in August, the operation has proved unexpectedly long and bloody, forcing Turkey to triple its original deployment amid dozens of combat deaths and hundreds of civilian casualties. 

It has also driven a wedge between Turkey and the United States, which initially backed a Kurdish-led force to retake the northern border town. 

Ankara views those Kurdish fighters as terrorists. Its operation also aims to thwart Kurdish hopes of establishing an autonomous zone along the Syria-Turkey border by preventing the Kurds from linking up territory east and west of al-Bab.

The Free Syrian Army (FSA), a loose coalition of Syrian Arabs and Turkmen, has been attacking al-Bab since early December, aided by Turkish warplanes, tanks and special forces.

On Thursday evening, the Britain-based Syrian Observatory for Human Rights monitoring network said the rebels had full control of the town.

“Al-Bab is free and under Free Syrian Army control after intensive operations against Daesh that lasted for months,” said Col. Abu Firas, a spokesman for the FSA, using an Arabic acronym for the Islamic State. “Many gave their lives to return al-Bab to its people again.”  

Victory in the Islamic State’s final stronghold along the Turkish border would deepen Ankara’s influence in an area of Syria where it has effectively created a buffer zone. 

It would also allow Turkish-backed forces to press on toward Raqqa, the Islamic State’s de facto capital in Syria, complicating an earlier U.S. plan to back Kurdish fighters in that effort.

Turkish Defense Minister Fikri Isik said the rebels were now combing al-Bab for mines. “We will be able to say that al-Bab is fully cleared of Daesh once the sweeping activity is concluded,” he told Turkey’s state news agency.

Under pressure across Iraq and Syria, the Islamic State has lost more than a quarter of its territory to U.S.-backed forces over the past year. The areas it leaves behind are often badly damaged in the fighting, and the militants routinely booby-trap buildings before retreating.

Turkey-backed Syrian opposition fighters take positions during their advance in al-Bab on Feb. 22. (Maan al-Shanan/AFP/Getty Images)

In a video published by the opposition-linked Step News Agency, a rebel commander stood in front of a car rigged with explosives. “We have defeated the Islamic State, and now we are on al-Bab’s northern highway,” he said. “This was one of their car bombs.”

Although the commander appeared to pose unarmed for the cameras, another man clutched a weapon tightly, scanning the horizon for threats as gunfire crackled in the distance.

The Islamic State-affiliated Amaq News Agency on Thursday highlighted the al-Bab offensive’s “heavy human and material losses,” claiming that more than 400 Turkish soldiers and Syrian rebel fighters have been killed and at least 41 tanks destroyed. 

Turkish officials have attributed the duration of the operation to their forces’ attempts to avoid civilian casualties. However, the Syrian Observatory said Thursday that Turkish shelling in the offensive has killed 444 civilians, including 96 children. 

An estimated 100,000 people lived in al-Bab in 2011 when Syria’s nationwide uprising against President Bashar al-Assad morphed into all-out war. Today, that figure is believed to stand in the low thousands.

Mustafa Sejari, an official with the al-Mutasim rebel group, said Islamic State fighters had used the area’s remaining residents as human shields by preventing them from leaving their homes.

Meanwhile, representatives of the Syrian government and the opposition gathered in Geneva for the resumption of long-stalled peace talks aimed at resolving the other war raging in Syria — a six-year-old conflict between forces loyal to Assad and the rebels. The battle against the Islamic State is not an issue in the Geneva talks.

Staffan de Mistura, the United Nations’ Syria envoy, set expectations low as he greeted the rival delegations at an opening ceremony at U.N. headquarters. “I’m not expecting miracles,” he said. “It is an uphill task.”

De Mistura urged the sides to take advantage of a cease-fire brokered by Russia with help from Turkey and Iran. Though it has reduced the level of violence, fighting continues in many parts of the country.

But with Assad’s government now secure after defeating the rebels in Aleppo in December, diplomats and analysts said he is unlikely to compromise.

Sly reported from Geneva. Zakaria Zakaria in Istanbul contributed to this report.