From the top-floor sniper position in western Raqqa, members of an American-backed militia scanned the ground for any signs of movement.
“We have hot soup, we have bread: Come out and surrender,” one of the fighters said on a loudspeaker. “The ISIS members and their families who surrendered to us are safe.”
I was one of a handful of journalists who accompanied the militia, known as the Syrian Democratic Forces, for about 10 days. Twice I went to the front lines in the city, which has been largely liberated after a four-month battle. I talked to civilians who had endured Islamic State rule for more than four years and survived.
Only a few weeks ago, the battle for Raqqa, the self-proclaimed capital of the Islamic State, appeared to be at a stalemate. Hundreds of die-hard Islamic State fighters there were using thousands of civilians as human shields.
But the resistance began to crumble in recent weeks. On Tuesday, the city was declared liberated, although pockets of fighting remain.
Last week, when I visited eastern Raqqa, it was hard to find a street or building that had not been damaged by the fighting. The ceaseless whiz and boom of shells fired by American-manned heavy artillery from a firebase 12 miles outside the city sent plumes of smoke rising from the relatively small area still under the Islamic State’s control.
Fighters from the militia kept watch from an observation post in a bombed-out building. Some of their comrades had been cut off and ambushed; one was dead, and two injured. Lacking armored vehicles, they had at first not been able to launch a rescue operation to retrieve the stranded soldiers.
In another bombed-out building several hundred yards away, the men spotted movement. Two of them sent controlled bursts of machine-gun fire through holes smashed in a stairwell wall. The men sent journalists, including me, back to the rear, as they braced for a counterattack.
The following day, I talked in a hospital with Mohammed Sheko, 25, who had been shot through the shoulder once the fighters did begin trying to retrieve the stranded unit.
Beside him was Salah al-Raqawi, 18, his friend and comrade from the same battalion, who had been injured two days earlier by a rocket-propelled grenade.
With both his arms fully covered in bandages, Mr. Raqawi was more incapacitated than his fellow patient and needed help to eat. His head propped against the worn metal railing of his bed, he was fed spoonfuls of rice and chicken by his injured friend.
Mr. Sheko told me that Islamic State fighters had been waiting to ambush the rescue operation and began their attack from the basement as soon as the troops entered.
When asked if he felt this was a cause worth being injured for, he replied: “It is worth more than that. It is worth dying for, for my people.”
Another young man, Omar al-Abed, 20, had died for the cause some three months earlier, but his body was recovered only recently, according to his cousin and fellow fighter, Abed al-Issa. He said that Omar had grabbed an Islamic State suicide bomber, shielding his comrades from the brunt of the blast.
Mr. Abed was buried last week at a martyrs’ cemetery in Hukumya, about nine miles northwest of Raqqa.
When it came time to fill his grave, a group of more than 20 militia fighters — men and women alike — put down their weapons and began to shovel. Dust blurred their camouflage uniforms and tears as dusk fell.
When they were nearly finished, there was some commotion to the side of the grave. The young man’s sister, who was wearing a blue head scarf, had collapsed in grief. She didn’t make a sound for 10 minutes or so, until the funeral was over.
The London-based Syrian Observatory for Human Rights says that more than 3,000 were killed during the battle in Raqqa, including 1,130 civilians. Many others are missing.
Last week, I visited a hospital supported by the charity Doctors Without Borders in the town of Tal Abyad, 55 miles north of Raqqa on the border with Turkey.
There I spoke with Abdel Hemedi, 52, who escaped Raqqa on Oct. 6 after being wounded in what he described as an airstrike a week earlier.
Mr. Hemedi told of how he woke to find himself in his neighbor’s house, crudely bandaged, the day after his home was hit. Still missing was his son Mohammed, who had been with him minding the family home for the duration of the battle.
Badly burned, and with a bleeding head wound, Mr. Hemedi was being cared for by his wife and youngest son, Bassam, whom he had been reunited with the night before after months of separation.
Mr. Hemedi’s wife, Kawther al-Obaid, 47, said she held out hope that Mohammed had survived. “I just have a feeling he is still alive,” she said. “I am thinking he will walk through the door at any minute.”
Although the battle for Raqqa may not be over, one turning point seems to have come on Sunday morning, when around 275 fighters and their families surrendered and evacuated on buses as part of a deal brokered by tribal elders, according to Omar Alloush, a member of the Raqqa Civil Council.
On Monday morning, I visited a defensive position held by the Syrian Democratic Forces at a hospital west of Raqqa. The commander in charge estimated that there were only 50 to 70 fighters left in the city.
The four-month-long campaign to retake Raqqa left behind a ghost city and killed thousands of civilians. Much of Raqqa, in an area that has been inhabited since antiquity, was leveled.
The physical destruction of the city was pervasive, and documentation of the damage has barely begun. The fighters I accompanied used destroyed buildings as shelters.
During the more than four years that Raqqa was under the control of the Islamic State, citizens endured violent and brutal repression. Residents — helped by Syrian exiles — risked their lives to document it through the project Raqqa Is Being Slaughtered Silently.
“We haven’t eaten bread since Ramadan, because we couldn’t buy the flour to make it,” Younes Omar, 37, a father of four who escaped with his family from one of the last contested areas of the city, told me on Monday morning, near the main soccer stadium on the western outskirts of Raqqa. He was inside a mosque that had been turned into a gathering point for the displaced.
As he spoke, his children — pale and undernourished — devoured a humble meal of chicken and bread.