RAQQA, Syria — The crowd was seething with frustration.

“We want to go inside!” one man yelled. “They told us when Raqqa is liberated we can go home.”

Some of the U.S.-backed fighters who drove Islamic State militants from the Syrian city in October tried to reason with him. It’s not safe, they said. Scores of people have been injured or killed by mines since the fighting ended.

“Haram!” the crowd shouted. “This is wrong!”

There have been many such testy exchanges at checkpoints as the fighters known as the Syrian Democratic Forces, an alliance of Kurdish and Arab militias, wrestle with the difficult business of governing a swath of territory reclaimed from Islamic State in northeastern Syria.

The challenges are especially acute in the city that Islamic State claimed as its capital and ruled with a bloodthirsty grip. Nearly two months after its capture, Raqqa remains a rubble-strewn ghost town.

The entire population — nearly 300,000 people — fled over more than four years of fighting, moving into displacement camps and crowding in with relatives in cities scattered across Syria and beyond. About 8,000 former residents have been allowed to return to a few outlying neighborhoods. But humanitarian workers say it could be years before most can go home.

The city is riddled with deadly booby traps and unexploded ordnance. Bombs have been found under rugs, inside ovens and refrigerators and, in at least one instance, stuffed into a teddy bear.

As many as 80 percent of its homes and businesses were gutted by ground fighting and airstrikes. And vital infrastructure — electricity plants, water pumps, sewer lines, hospitals, schools — was destroyed.

The United States has dispatched experts and equipment to help remove explosives, clear rubble and repair the structures that aid workers and local authorities need to operate in the city. But U.S. officials have stated repeatedly that they are no longer in the business of “nation-building.”

Even after the departure of Islamic State, Raqqa remains a contested city, claimed by both the government of Syrian President Bashar Assad and the Kurdish-led fighters who liberated it.

In the absence of a broader political settlement, the victorious Syrian forces have set up a civilian council made up of local tribal leaders and technocrats to administer the province to which Raqqa belongs. But the council does not have the resources to rebuild an entire city.

As weeks stretch into months, frustration is building among Raqqa’s displaced multitudes — frustration that some here worry could turn the mostly Arab population against the Kurdish-led liberators and create fertile ground for an Islamic State comeback.

Looming on the horizon is the prospect of more fighting. Assad has vowed to take back all parts of the country that have fallen from government control since the start of a grinding civil war, well into its seventh year, that has killed hundreds of thousands and left many places in ruins.

Now that government forces, backed by Russian air power and Iran-sponsored militias, have driven the militants from the last settlements they held in Syria, the president’s aides have signaled he may soon order an advance on Raqqa.

Members of the Kurdish People’s Protection Units, which form the backbone of the force now in control of the city, are also bracing for a fight with Turkey, which has sent troops into Syria in part to thwart efforts to carve out a semiautonomous Kurdish federal zone in the north. Turkey views the Syrian Kurdish fighters as terrorists because of their ties to rebels who have waged a decades-long insurgency within its borders.

The Kurdish fighters, who now control about a quarter of northern Syria, say they will allow Raqqa residents to decide whether they wish to be part of the Kurdish zone but have vowed to defend the city against all “external threats.”

The Pentagon is drawing down the program to arm the Kurds and pulling out 400 Marines who provided artillery support during the battle for Raqqa.

The dusty agricultural hub was the first provincial capital to slip from Syrian government control in March 2013. Islamic State, also known by the acronym ISIS, took over the city the following January, after clashes with other groups opposed to Assad’s rule.

Over the years, Raqqa has faced relentless airstrikes by Assad’s government and a coalition formed by the U.S. to fight the militants. But it was the final assault, launched in early June, that utterly devastated the city.

Residents described terrifying days spent hunkered down in their homes as coalition shells rained down. More than 20,000 munitions were deployed during the battle, killing an estimated 1,464 civilians, according to the monitoring group Airwars.

The last residents were evacuated after the Kurdish-led forces declared the city liberated on Oct. 17.

“The job we are doing now is much harder than liberating the city,” said a Kurdish commander who goes by the nom de guerre Klara Raqqa. “We are so busy defusing mines, clearing streets, talking to civilians.”

The Syrian forces in charge of Raqqa have declared most of it off-limits to civilians for at least three months. But after a protest by displaced residents from the eastern neighborhood of Mishlib turned violent in October, some families were allowed to move back there.

Bomb disposal teams were diverted to the neighborhood from other parts of the city, but many explosive devices remain hidden in houses, gardens and streets. The aid group Doctors Without Borders said it treated 49 people there for blast injuries over 10 days in late November.

Despite the risks, the United Nations estimates more than 5,000 people have returned to Mishlib. Watha Haider, who lived in the area with her husband and four children, is not among them.

“The house I was in was destroyed, so we can’t go back,” she said.

Haider and her family can’t afford to rebuild. What little savings they had they used to buy a motorcycle to flee the city when it was under bombardment. So like thousands of others, they are stuck in a tent at Ain Issa for the winter.

”It’s very cold,“ she said. “We are six people in the tent, and we only have three blankets and two mattresses.”

Others prefer to take their chances in the ruined city.

Ahmed Hamid, a shopkeeper, stood recently among a cluster of angry men stopped at a checkpoint outside Raqqa. He had heard that his area wasn’t as badly damaged as others and wanted to move back.

“If there is a mine inside my house, fine, I will die,” he said. “It is better than living in a tent.”

alexandra.zavis@latimes.com