Killis, Turkey: 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 farther.

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 PKK.

“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 PKK.”

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 increasingly clear that Turkey and its allies will have to be reckoned with in whatever negotiation might eventually end the 7-year-old conflict.

“Turkey and the FSA have become an undeniable force in Syria,” Unluhisarcikli said, referring to the Free Syrian Army.

The deepening engagement places Turkey in the middle of the fight between the regime of 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 2 million people live in Idlib, half of them displaced from elsewhere in Syria, and they are under daily attack from Syrian government and Russian air strikes.

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, an Al Qaida-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 YPG, which the United States has supported to combat Daesh.

“The question is, can it be settled by way of negotiation with the US,” 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 YPG 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, Ulgen said, the United States has been sending conflicting signals, with the State Department working on a compromise and the Pentagon and US commanders in the region resisting moves against the YPG.

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 US and Turkey,” Unluhisarcikli said. “If an agreement is reached with the US about Manbij, it will have an enormously important effect on Turkey-US relations.”

Erdogan seemed to indicate 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,” 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.