After two months of uncertain fighting, Turkey appears suddenly to be riding high in its military campaign to take control of a larger piece of northern Syria.
Along the border, studded with spring flowers and pistachio and olive groves, the artillery guns and fighter jets that until recently pounded the low mountains have fallen silent since Turkish forces captured the enclave of Afrin last weekend.
The victory has been widely celebrated in Turkey and has further emboldened President Recep Tayyip Erdogan, who has vowed to take his campaign across northern Syria and even into Iraq.
Yet the road ahead for Turkey in Syria is uncertain and fraught with risks.
The deepening inroads of Turkey and its allies have been tolerated so far by the two powers that control Syria’s airspace, Russia and the United States. But Turkey may yet meet resistance if it pushes much further.
There is every risk that Turkey, which has a less than illustrious history dealing with its Kurdish population, could find itself embroiled in a guerrilla war in Syria, an extension of its decades’ old battle against the Kurdish insurgency at home led by the Kurdistan Workers’ Party, or P.K.K.
“Afrin is not a region easy to command for Turkey,” said Ozgur Unluhisarcikli, director in Turkey of the German Marshall Fund of the United States. “Not only is the majority of the population there Kurdish, but an important part of the population is sympathetic to the P.K.K.”
Even Turks’ euphoria surrounding their sudden win in Afrin was quickly tempered by the messy aftermath of that battle.
No sooner had Turkey’s proxies on the ground, the Free Syrian Army, captured Afrin city than social media lit up with video and messages depicting looting by its fighters.
The environment remains volatile. A booby trap planted in Afrin killed seven civilians and four Free Syrian Army soldiers this week. A Syrian journalist was among those killed, the Committee to Protect Journalists reported.
Yet the fall of Afrin has made it progressively clear that Turkey and its allies will have to be reckoned with in whatever negotiation might eventually end the seven-year conflict.
“Turkey and the F.S.A. have become an undeniable force in Syria,” Mr. Unluhisarcikli said, referring to the Free Syrian Army.
The deepening engagement places Turkey in the middle of the fight between the government of President Bashar al-Assad of Syria, who is backed by Russia, and the rebel groups determined to remove him from power.
Some of those rebel groups are supported by the United States, but are bitterly opposed to Turkey and its proxies.
Afrin’s capture changes things on the ground. It opens a link between parts of northern Syria, where Turkish forces maintain a presence, and the rebel-held western province of Idlib, where Turkey has been steadily expanding its presence.
About two million people live in Idlib, half of them displaced from elsewhere in Syria, and they are under daily attack from Syrian government and Russian airstrikes.
The opposition is dominated by radical Islamist groups, and Russia has been pushing Turkey to contain the rebels. But Turkey has been reluctant so far to confront the strongest among them, a Qaeda-linked group, Tahrir al-Sham.
Flush with success, its Free Syrian Army allies are first set on pushing eastward from Afrin, and on to the city of Manbij.
Along the way is a string of 15 Arab villages from which many of the Free Syrian Army fighters taking part in the operation have been displaced.
The villages are now controlled by the same Kurdish group ousted from Afrin, known as the People’s Protection Units, or Y.P.G., which the United States has supported to combat the Islamic State.
“The question is, can it be settled by way of negotiation with the U.S.,” said Sinan Ulgen, chairman of the Center for Economic and Foreign Policy Studies in Istanbul.
Turkish officials say they have agreed to the outlines of a plan with the Americans for the Y.P.G. to withdraw to east of the Euphrates River.
That could allow Turkey and the United States to undertake a joint operation in Manbij, and to avoid a confrontation between the NATO allies.
But, Mr. Ulgen said, the United States has been sending conflicting signals, with the State Department working on a compromise, and the Pentagon and American commanders in the region resisting moves against the Y.P.G.
An agreement between the United States and Turkey over Manbij could usher in a new era of collaboration between them in Syria after mounting tensions.
“Manbij is important for reinstituting the confidence between the U.S. and Turkey,” Mr. Unluhisarcikli said. “If an agreement is reached with the U.S. about Manbij, it will have an enormously important effect on Turkey-U.S. relations.”
Mr. Erdogan seemed to indicate that he was ready to work with the United States on a joint effort to secure the city and region.
“If you are strategic partners with us, you should show us respect and walk with us,” Mr. Erdogan said on Tuesday at a weekly gathering of lawmakers from his party.
He has insisted that Turkey’s aim is to secure areas where the hundreds of thousands of displaced Syrians — many of whom now live in Turkey — could return and run their own lives.
One showcase for that effort is the town of Jarabulus, 100 miles east of Afrin, which Turkey sees as a blueprint for Afrin.
Eager to show off its successful administration of areas of northern Syria under Turkish protection, the Turkish government arranged a rare visit for The New York Times.
Liberated from the Islamic State in 2016, Jarabulus is now run by a local Syrian council of teachers and engineers, most of whom took part in the original uprising against the Assad government.
A Turkish civil servant, Dr. Yasar Aksanyar, serves as deputy governor, coordinating reconstruction and humanitarian assistance, and the Turkish military, along with the Free Syrian Army, gives security. “The local council makes the decisions, but we provide the experience,” he said.
The main challenge was infrastructure, the lack of government services, water and electricity, he said. A doctor and humanitarian administrator, he added that his priority was to help disadvantaged groups.
The small border town is swollen to over twice its original population, with people displaced from all over Syria, and Turkish assistance does not go far. People in a makeshift camp complained they had received no assistance in months.
But with Turkey’s help, the administration has opened a hospital and over 100 schools. The town is busy, with commerce and construction sites on every street.
Some Syrians, as well as Turks, condemn the presence of the Turkish military in Syria as a colonial exercise. But the Turkish presence has allowed those opposed to the Assad government to live freely without the threat of bombings.
Many of those there today said that Jarabulus was preferable to the repression they had experienced under the Assad government or radical Islamists, and to the compulsory conscription the Y.P.G. enforced in areas it controls.
One man, Saleh Khodor, a doctor from the southern city of Deir al-Zour, pushed through the crowd and interrupted the deputy governor to address his visitors.
“I have lived in almost all areas of Syria, under the Islamic State, the Syrian Democratic Forces and now here,” he said. “Ninety percent of Syrians would come, if they had the chance to live in this area.”
He paid smugglers and traveled 15 days from the south with his family to reach Jarabulus.
“I came for the security, second for the schools, and third, it’s a job opportunity,” he said. “It’s safe, it has freedom of speech.”