Syria war: Why the battle for Raqqa is far from won
The battle for Raqqa is far from won.
But in the town of Ayn Issa, barely 35 miles (56km) north of the front lines, they are already looking at a future post-caliphate.
On Wednesday, Brett McGurk, the US envoy to the coalition fighting the group that calls itself Islamic State (IS), arrived at the headquarters of the Raqqa Civilian Council to meet local leaders-in-waiting.
"There are tremendous challenges ahead," he said.
"The United States is committed to defeating Daesh [IS]. That's why we're here. And we want to make sure that what comes after Daesh is stable.
"And if you look at the record to date, coalition-backed operations in Iraq and Syria have cleared out about 60,000 sq km of territory. We've liberated over four million people."
Mr McGurk's presence in Ayn Issa is part of a growing engagement from the US, which is backing the Syrian Democratic Forces (SDF), a coalition of Arab and Kurdish fighters leading the assault on Raqqa.
As they advance into the city, families are fleeing. Many end up in a camp on the outskirts of Ayn Issa. Their futures look as uncertain as the future of Syria itself after more than six years of war.
The people now staying in tents until recently lived under the harsh rule of IS. For some, even the heat and the dust feel like respite.
Jihadi wives' corner
But not all the inhabitants of the Ayn Issa camp were in the caliphate against their will.
One corner of the camp is reserved for the wives and children of IS fighters. Perhaps not surprisingly, these people are not popular.
Nour left Lebanon for Raqqa two years ago to join her husband, a jihadi. When he was killed, she married a Tunisian.
And so she joined the ranks of a relatively privileged group: the wives of foreign fighters. She still seems to have little sympathy for the treatment of the thousands of Yazidi sex slaves at the hands of their IS captors.
"There was a lot of tension between the wives and the sex slaves," she said.
"Some of the wives even divorced their husbands because of that. They were spending too much on the sex slaves, buying them the best makeup, clothes and accessories.
"My first husband had an app on his phone. It was a market for sex slaves. They were sharing photos of the sex slaves with the best makeup and clothes, and asking $2,000 [£1,538] for this one, $3,000 for that one. A virgin cost $10,000."
The caliphate may be crumbling but the IS mentality persists.
'Precise and careful'
If the self-declared capital of IS falls, it will be in large part thanks to the support for the SDF from US forces and their international allies, including Britain.
A US military transport plane touches down on a dirt runway carved discreetly into a hillside. This is the main logistics hub for the American effort in northern Syria.
From this base, they support their own forces and arm the SDF.
The US has been reluctant to publicise its presence in Syria. Their troops number in the hundreds. They will not say exactly how many.
Their special forces are involved in fighting on the ground while their planes are bombing Raqqa from the sky.
UN war crimes investigators warned earlier this month of "staggering loss of life", with hundreds of civilians killed since March, as coalition air strikes and artillery support the Kurdish-led offensive on the city.
Lt Gen Stephen Townsend, the overall commander of the international coalition against IS in Iraq and Syria, rejected the charge that the US was taking insufficient care in its bombardment.
"I would challenge anyone to find a more precise and careful campaign in the history of warfare on this planet," he told the BBC.
"I think we are being as careful as we need to be and as we can be, and I would challenge the individual from the UN who made this hyperbolic statement that civilian casualties are staggering. Show me some evidence of that."
Common enemy... for now
The American logistics hub in northern Syria is one of a number of US bases in the area. Much of the infrastructure has been put in place in the last six months.
Getting in is often easier that getting out, as the US military discovered in Afghanistan and Iraq. Syria may be no exception.
"ISIS [IS] is certainly not defeated when Mosul is liberated or Raqqa is liberated," says Lt Gen Townsend.
"There is a lot of hard work left to do. Mosul and Raqqa are intermediate objectives on a path to a final victory."
What that final victory might look like is unclear. The end of the caliphate will not mean the end of the war in Syria.
Earlier this month, a US fighter jet shot down a warplane belonging to the Russian-backed regime in Damascus.
For now, Washington and Moscow share a common enemy.
But once IS is gone, two big powers will be left backing different sides in an unfinished war. The potential for confrontation is real.