U.S.-backed Syrian forces liberated the city of Raqqa from Islamic State militants on Tuesday, a senior commander said, in a major defeat for the collapsing extremist group that had proclaimed the city to be the capital of its “caliphate.”

Although clashes in Raqqa have ended, the Kurdish-led Syrian Democratic Forces are in control, combing the city in northern Syria for land mines and searching for any Islamic State sleeper cells, SDF Brig. Gen. Talal Sillo told The Associated Press.

Sillo said a formal declaration that Raqqa has fallen would be made soon, once troops finish their clearing operations in the city on the banks of the Euphrates River.

>> ISIS on verge of collapse: How we got here and what comes next >>

Col. Ryan Dillon, a spokesman for the U.S.-led coalition, said it has not yet received official reports that the city was cleared, describing mines and booby traps throughout Raqqa that have killed returning civilians and senior SDF commanders in recent days. One of those killed Monday was the head of the internal security force affiliated with the SDF.

Open gallery view A member of the Syrian Democratic Forces talks on the radio near Raqqa's stadium as they clear the last positions on the frontline, Raqqa, Syria, October 16, 2017. Credit: BULENT KILIC/AFP

Open gallery view Fighters of Syrian Democratic Forces raise a white flag near the National Hospital complex where the Islamic State militants are holed up, at the frontline in Raqqa, Syria October 16, 2017. Credit: ERIK DE CASTRO/REUTERS

Another challenge for the troops is searching the tunnels that were dug by the militants around the city, Dillon said.

“This will take some time, to say that the city is completely clear,” he told AP. “We still suspect that there are (Islamic State) fighters that are within the city in small pockets.”

The loss of Raqqa will deprive the militants of a major hub for recruitment and planning, Dillon said, because the city attracted hundreds of foreign fighters and was a place where attacks in the Middle East and Europe were planned. He added that the militants remain active in Syria, farther south around the eastern province of Deir el-Zour.

“This has been the wellspring of (Islamic State) as we know it,” he said. But he stressed that the group’s military defeat “doesn't mean the end of (Islamic State) and their ideology.”

Dozens of militants who refused to surrender made their last stand earlier Tuesday in Raqqa's sports stadium, which Islamic State had turned into a notorious prison in the more than three years it held the city.

The SDF forces captured Raqqa's main hospital, the other last remaining Islamic State holdout that had served both as a medical facility and a command center. The SDF fighters have not gone through it to clear it, Dillon said.

According to Dillon, the coalition has not carried out any airstrikes in the past three days to allow civilians to leave. The SDF has also called on Islamic State fighters to surrender, and about 350 have turned themselves in, he said, adding that none were high-value targets.

In recent months, Islamic State has steadily lost territory in Iraq and Syria, including Iraq's second-largest city of Mosul.

After the group seized Raqqa from other Syrian rebels in early 2014, it transformed the one vibrant metropolis into the epicenter of its brutal rule where opponents were beheaded and terror plots hatched.

Islamic State militants had been cornered in and around Raqqa’s stadium, and it was not immediately clear after Sillo's statement whether any were still inside it.

“The stadium is a huge structure with underground rooms and tunnels. There are also buildings around it” still under the control of Islamic State, said SDF spokesman Mustafa Bali.

A senior Kurdish commander said later that the stadium has been checked and cleared of land mines. SDF forces raised their own flag in the stadium, he added.

Earlier, he said 22 Islamic State militants were killed in the advance on the hospital.

On Monday, the SDF captured “Paradise Square,” Raqqa's infamous public square that was used by the militants to perform beheadings and other killings in front of residents who were summoned by loudspeakers and forced to watch. Bodies and severed heads would be displayed there for days, mounted on posts and labeled with their crimes, according to residents, who later dubbed it “Hell Square.”

With the capture of the hospital, the last black Islamic State flag was taken down, according to the Kurdish-run Hawar news agency. A video released by the news agency showed the clashes around the hospital, which appeared riddled with bullets and partly blackened from a fire.

A senior Kurdish commander said there was no sign of civilians in the stadium or around it, but he added that his troops were being cautious because of possible land mines. He spoke on condition of anonymity because he was not authorized to talk to reporters.

The battle for Raqqa began in June and has dragged for weeks as the SDF fighters faced stiff resistance from the militants. The city suffered devastating damage, with most of its buildings leveled or in ruins. The Syrian Observatory for Human Rights said more than 1,000 civilians were killed in the campaign.