TWO months after Turkish tanks flanked by Syrian insurgents wrested it from Islamic State (IS), the border town of Jarablus, in Syria’s north, is slowly getting back on its feet. Schools have reopened. Aid has begun to trickle into the area, as have thousands of people from neighbouring villages and some 7,700 Syrian refugees returning from Turkey. “Finally we have enough food,” says Aminah Hardan, a young mother of nine who arrived in Jarablus from Aleppo in early 2013, only to watch IS take over the city months later. The militants, she says, once asked her husband to whip her for not wearing a niqab. Since the Turks rolled into town, she has swapped it for a yellow headscarf.

For years, Turkey’s president, Recep Tayyip Erdogan, has urged his Western allies to help him carve out a buffer zone in Syria’s north to provide refugees with a haven and anti-regime insurgents with a bridgehead. He now has what he wished for. With Turkish troops and their Syrian proxies in control of an area stretching from Jarablus to Azaz, some 90km (55 miles) west, Mr Erdogan has killed two birds with one stone. He has pushed IS militants far enough from the border to lower the risk of rocket attacks against Turkish towns. And he has stopped the People’s Protection Units (YPG), a Kurdish militia backed by America but regarded by the Turkish government as a terrorist group, from linking its eastern and western cantons.

Turkish and rebel forces intend to push further south. Earlier this month they easily overran the town of Dabiq (see article). They now plan to march on al-Bab, where the fighting is expected to be much more intense. Mr Erdogan says they may soon head towards Raqqa, the jihadists’ capital. All this may become a drain on resources. Turkey cannot make much more headway without additional troops, says Can Acun, a researcher at SETA, a pro-government think-tank.

Some of the rebels in Jarablus would eventually like to take the fight to the regime of Bashar al-Assad. “For us, the most important thing is to break the siege of Aleppo,” says Fikret, a young fighter. They may not get their wish. Having grudgingly accepted that Mr Assad is not going away, Turkey is no longer in the business of regime change in Syria. Focused instead on its backyard, it has struck a bargain with Russia, analysts say. “Russia will let Turkey keep the Jarablus pocket, and in exchange Turkey will pull back the opposition from Aleppo,” says Behlul Ozkan, an assistant professor at Marmara University. “This makes Turkey dependent on Russia. If it acts against Russian interests, Russia can make problems for it in Syria.”

Even if the increasingly unpredictable Mr Erdogan has reconciled himself to Mr Assad’s rule in Syria, his ambitions extend rather further than Jarablus. Over the past couple of weeks, he has repeatedly claimed a century-old right to intervene on his southern periphery. “From now on…we will not wait for terrorist organisations to come and attack us,” Mr Erdogan said in a speech on October 19th. “They will not have any place to find peace abroad.” Turkish jets struck YPG positions in Syria just hours later, a new front in a war with Kurdish insurgents, the PKK, who are linked to the YPG. The bombing killed up to 200 fighters, the army said.

Over the objections of his Iraqi neighbours and American allies, Mr Erdogan has also clamoured for a greater role in the offensive against IS in Mosul, citing a duty to protect his fellow Sunnis from Shia militias. His talk of an incursion is probably bluster, designed to sustain a wave of nationalist frenzy that Mr Erdogan seeks to ride to a new constitution and an executive presidency next year. “For that rhetoric to have any weight, you need to have 50 times as many troops and tanks on the ground in Iraq,” says one analyst. But Mr Erdogan may surprise. “We know this business in this region,” the president warned the West in his speech. “You are foreigners here. You do not know.”