RMEILAN, Syria — After boiling crude oil from the ground near here all day in a metal tank to refine it into diesel, Ali Mohammed braved the fumes to bang the tank’s drain open with a shovel. He stepped back as the dregs oozed into the dirt and burst into flames.
As a column of putrid smoke rose into the sky, he pulled a cigarette from his oil-soaked shirt and explained how the Syrian civil war had turned him into a diesel bootlegger.
He had once worn clean scrubs as a nurse in a state-run hospital, but was fired after rebels took over his village, making all residents suspect, he said. Later, stretched by the war, the government had left the area, leaving its oil up for grabs.
“Before, we saw the wells but we never saw the oil,” Mr. Mohammed said. Now, although its fumes made them sick, the oil helped hundreds of families like his scrape by.
“My wife doesn’t complain about the smell as long as there’s money,” Mr. Mohammed said.
Such scenes dotted the map during a recent 10-day visit in northeastern Syria, along the Turkish border. Everyone here, it seems, has an angle to work, scrambling to fill the void left by the collapse of the Syrian state.
The Islamic State, also known as ISIS or ISIL, saw this crossroads as a prime place to expand its so-called caliphate. It was far from the major interests of the Syrian government in Damascus and along good river and road networks to allow the quick movement of fighters and contraband.

But as Kurdish fighters pushed the Islamic State jihadists out, they sought to stamp their vision of a better life onto northern Syria: an autonomous enclave built on the principles — part anarchist, part grass-roots socialist — of a Kurdish militant leader whose face now adorns arm bands and murals across the territory.
Others, like Mr. Mohammed, are just trying to get by: the farmers, herders and smugglers, or those just trying to piece their communities back together after months under the black flag and public punishments of the Islamic State.
The police are gone, and militias have flourished, snarling traffic with checkpoints and covering lampposts with pictures of dead fighters. Shuttered gas stations stand near shacks where fuel is sold in plastic jugs. And abandoned government offices house ad hoc administrations that struggle to keep the lights on.

Kurdish Utopia

The Kurdish militia that grew to become the dominant power in this part of Syria over the past year — known as the People’s Protection Units — has managed to roll back the Islamic State in many areas, carving out a swath of relative security that the residents call Rojava.
The community leaders here are working to set up a new order based on the philosophies of the separatist leaderAbdullah Ocalan, of the Kurdistan Workers’ Party, or P.K.K., who is serving a life sentence for treason in Turkey.
“Turn your land, your water and your energy into a commune to build a free and democratic life,” reads a common billboard featuring Mr. Ocalan’s mustachioed face. His supporters call him “president” or “uncle.”
Influenced by the American anarchistMurray Bookchin, Mr. Ocalan has called for autonomous rule by local committees unbound by national borders. The project’s proponents say they do not seek to break up Syria but are leading a long-term social revolution that will ensure gender and minority rights.
“The Syrian people can solve the Syrian crisis and find new ways to run the country,” said Hediya Yusif, a co-president of one of the area’s three self-declared cantons.
But much about the new administrations remains aspirational. No foreign power has recognized them, and Turkey looks on them with hostility, fearing that they want to declare an independent state along its border. Many of their workers are volunteers or functionaries still paid by the Syrian government.

The new order’s complexities are glaring in the strongly Kurdish town of Qamishli, where monuments to fallen militia fighters and billboards in red, green and yellow — the flag colors of the People’s Protection Units, or Y.P.G. — dominate roundabouts.
“The homeland is belonging, loyalty and sacrifice,” read one sign, showing women farming and holding Kalashnikovs.
One morning, dozens of women waved militia flags on the town’s main road, waiting for the bodies of Kurdish fighters to arrive for burial in a sprawling martyrs’ cemetery.
Renas Ghanem stood among them with a photograph of her sister, Silan, who had quit high school to join a Kurdish militia in Iraq and returned to fight the Islamic State in Syria, where she was killed.

Nearby, however, loomed a statue of the former strongman Hafez al-Assad, father of the current Syrian president, in an area of continued Syrian government control only a few blocks long, where the Syrian police, in white shirts and black caps, direct traffic.
Kurdish leaders do not hide their resentment of the Syrian government for its treatment of Kurds. But allowing the government to control the town’s airport keeps it open, they say, and its largely symbolic presence downtown has prevented the government airstrikes that have destroyed rebel areas elsewhere.
“The Y.P.G. could chase the regime out in one hour, but what would come after?” said Ahmed Moussa, a Kurdish journalist. “Barrel bombs and airstrikes.”
The territory’s main link to the outside is two rusty boats that ferry passengers across a river from Iraq and a pontoon bridge for cargo. Trucks leaving Syria on a recent day carried cows and sheep; those entering hauled soft drinks and potato chips.
Despite improved security in some places, unemployment and the threat of renewed fighting have sent many people from this area fleeing by boats to Europe.
“The situation in Rojava can’t keep people here,” said Shivan Ahmed, a butcher’s assistant in the town of Amuda who earns less than $3 a day.
His wife and 7-month-old son had recently left on a boat that sank near Turkey, he said. They were rescued, but 13 of their relatives, mostly women and children, were still missing.
Still, he said, his neighbors keep leaving.

Marks of ISIS

Until this year, the Islamic State controlled much of this area, and relics of its rule remain: black signs quoting the Islamic State’s self-proclaimed caliph, Abu Bakr al-Baghdadi; “The Islamic State” and the flag of the caliphate painted in black and white on curbsides and archways; tombs reduced to mounds of rubble.
The group’s transport hub was Tal Abyad, a town on the border with Turkey that served as a transit point for foreign jihadists and a crossing for goods, ranging from energy drinks to fertilizer used to make bombs.
Now it is in Kurdish hands. Residents who remained throughout recall the presence of the jihadist fighters like an eerie dream.
“They used to come in all the time, and each one would eat two kilos!” said the 70-year-old owner of a kebab restaurant. To please the new rulers, he had hung curtains in a corner to create a separate women’s section and put the television on Quranic recitation; other programming was banned.
Executions took place every week or two near the fountain, he said, where an Islamic State “media point” — still standing — screened jihadist videos. And a cage remained at another roundabout where the jihadists locked up men caught smoking or playing cards.
The restaurant owner did not miss them, he said. But he would not give his name, out of fear of potential sleeper cells. (“They’ll put us on the assassination list,” he said.)
Nearby, a young woman in a bridal salon with wedding dresses hanging from the walls said business had boomed with so many women marrying foreign fighters.
“They came to dye their hair, to get ready for weddings, to do their makeup, anything,” she said.
Still, the jihadists threatened her at first for plucking her eyebrows, a forbidden practice.
“They saw me and said, ‘If we see you again with your eyebrows done, we’ll close your shop,’” she said. She complied until they left.
“Now I do them as I want,” she said, raising her sickle-shaped brows.
The town has a new local council headed by an Arab man and a Kurdish woman that has struggled to restore services — the jihadists looted the generators, water pumps and hospital supplies beforewithdrawing in June. But funding is short.
“We have no official, stable income,” said the Arab man who is a council co-leader, Mansour Salloum.
The jihadists also raided the local Armenian church, defacing its crosses, building prison cells and hanging a noose nearby. The whiteboards in its abandoned school still bear lessons about weapons and explosives.
One Armenian congregant, Rafi Kevorkian, had remained in town and paid a minority tax of more than $100 a year so the jihadists would not confiscate his home, he said.
He still has his receipt.
“I never threw it away,” he said, “because you never know what is going to happen next.”