Syrian rebels backed by Turkish special forces, tanks and warplanes entered Jarablus, one of Islamic State's last strongholds on the Turkish-Syrian border, on Wednesday.
But President Tayyip Erdogan and senior government officials have made clear the aim of "Operation Euphrates Shield" is as much about stopping the Kurdish YPG militia seizing territory and filling the void left by Islamic State as it is about eliminating the ultra-hardline Islamist group itself.
A Turkish security source said the army shelled the People's Protection Units (YPG) south of Jarablus. Turkey's state-run Anadolu agency described the action as warning shots.
Gunfire and explosions echoed around hills in the region on Thursday, a day after the incursion first began.
Some of the blasts were triggered as Turkish security forces cleared mines and booby traps left by retreating Islamic State militants, according to Nuh Kocaaslan, the mayor of Karkamis, which sits just across the border from Jarablus. He said three Turkish-backed Syrian rebels were killed but no Turkish troops.
Turkey, which has NATO's second biggest armed forces, demanded that the YPG retreat to the east side of the Euphrates river within a week. The Kurdish militia had moved west of the river earlier this month as part of a U.S.-backed operation, now completed, to capture the city of Manbij from Islamic State.
Ankara views the YPG as a threat because of its close links to Kurdish militants waging a three-decade-old insurgency on its own soil. It has been alarmed by the YPG's gains in northern Syria since the start of the Syrian civil war in 2011, fearing it could extend Kurdish control along Turkish borders and fuel the ambitions of Kurdish insurgents in Turkey.
Turkey's stance has put it at odds with Washington, which sees the YPG as a rare reliable ally on the ground in Syria, where Washington is trying to defeat Islamic State while also opposing President Bashar al-Assad's government in a complex, multi-sided, five-year-old civil war.
The Syrian Kurdish force is one of the most powerful militias in Syria and regarded as the backbone of the Syrian Democratic Forces (SDF), a U.S.-backed alliance formed last October to fight Islamic State.
Turkish Defense Minister Fikri Isik said the Kurdish PYD party, the political arm of the YPG, wanted to unite Kurdish-controlled cantons east of Jarablus with those further west. "We cannot let this happen," he said.
"Islamic State should be completely cleansed, this is an absolute must. But it's not enough for us ... The PYD and the YPG militia should not replace Islamic State there," Isik told Turkish broadcaster NTV.
Euphrates
US Secretary of State John Kerry told Turkish Foreign Minister Mevlut Cavusoglu by phone on Thursday that YPG fighters were retreating to the east side of the Euphrates, as Turkey has demanded, foreign ministry sources in Ankara said.
A spokesman for the U.S.-led coalition against Islamic State said the SDF had withdrawn across the Euphrates, doing so "to prepare for the eventual liberation" of Raqqa, the radical group's stronghold which lies further east.
Isik said the retreat was not yet complete and Washington had given assurances that this would happen in the next week.
"If the PYD does not retreat to east of the Euphrates, we have the right to do everything about it," the minister said.
The offensive is Turkey's first major military operation since a failed July 15 coup shook confidence in its ability to step up the fight against Islamic State. It came four days after a suicide bomber suspected of links to the group killed 54 people at a wedding in the southeastern city of Gaziantep.
U.S. Vice President Joe Biden, who met Erdogan during a trip to Turkey on Wednesday, said Turkey was ready to stay in Syria for as long as it takes to destroy the radical Islamist group.
"I think there has been a gradual mind shift ... in Turkey, with the realization that ISIL is an existential threat to Turkey," he told reporters during a visit to Sweden, using an acronym for the militant group.
A Turkish official said the ground incursion had been in the works for more than two years but had been delayed by U.S. reservations, resistance from some Turkish commanders, and a stand-off with Russia which had made air cover impossible.
Turkey had made the case more strongly to Washington over the past few months, had patched up relations with Russia, and had removed some of the Turkish commanders from their posts after finding they were involved in the coup attempt, paving the way for the operation to go ahead, the official said.
The incursion comes at a testing time for Turkish-U.S. relations. Erdogan wants the United States to extradite Fethullah Gulen, a Turkish cleric who has lived in self-imposed exile in Pennsylvania for 17 years and whose religious movement Turkey blames for staging last month's failed coup.
Washington says it needs clear evidence of Gulen's involvement and that it is a matter for the courts, a position that has sparked an outpouring of anti-Americanism from Turkey's pro-government media. Gulen denies any role in the coup attempt.
Rebels advance
The sound of gunfire, audible from a hill on the Turkish side of the border overlooking Jarablus, rang out on Thursday and black smoke rose over the town. War planes flew overhead.
A senior Turkish official said there were now more than 20 Turkish tanks inside Syria and that additional tanks and construction machinery would be sent in as required. A Reuters witness saw at least nine tanks enter on Thursday, and 10 more were waiting outside a military outpost on the Turkish side.
"We need construction machinery to open up roads ... and we may need more in the days ahead. We also have armored personnel carriers that could be used on the Syrian side. We may put them into service as needed," the official said.
Erdogan said on Wednesday that Islamic State had been driven out of Jarablus and that it was now controlled by Turkish-backed Syrian rebels, who are largely Arab and Turkmen.
"The myth that the YPG is the only effective force fighting Islamic State has collapsed," Erdogan's spokesman Ibrahim Kalin wrote on Twitter, reflecting Turkish frustration at how closely Washington has been working with the Kurdish militia.
Saleh Muslim, head of the Kurdish PYD, said on Wednesday that Turkey was entering a "quagmire" in Syria and faced defeat there like Islamic State. Redur Xelil, spokesman for the YPG, said the intervention was a "blatant aggression in Syrian internal affairs".
After seizing Jarablus, the Turkish-backed rebels have advanced up to 10 km (6 miles) south of the border town, rebel sources and a group monitoring the war said.
But the Syrian Observatory for Human Rights also said Kurdish-backed forces opposed by Ankara had gained up to 8 km of ground northwards, apparently seeking to pre-empt advances by the rebels.