Turkish troops and tanks crossed into Syria on Wednesday in support of a new U.S.-backed offensive against the Islamic State, helping Syrian rebels to swiftly recapture an important border town but also adding another layer of complexity to Syria’s deeply complicated war.

By late afternoon, rebel units with the Free Syrian Army had swept into the center of the Syrian town of Jarabulus, the Islamic State’s last foothold on the Turkish border.

The rebels encountered almost no resistance from Islamic State fighters, who fled ahead of the advancing force, according to rebel commanders in the area. Photographs posted on social media showed rebels posing in front of deserted government buildings in the town’s central square and raising the flags of Turkey and the Free Syrian Army over the gates to the town.

“There wasn’t much resistance at all from ISIS forces and they retreated even faster after Turkish troops marched across the border,” said Ahmed al-Gader, a rebel fighter speaking from Jarabulus. “We have taken over the main buildings of the town, and things are very quiet now.”

The offensive coincided with a crucial visit to Ankara by Vice President Biden and seemed timed to demonstrate that Turkey and the United States remain close allies in the war against the Islamic State, also known as ISIS, despite the tensions that have erupted in their relationship since last month’s coup attempt in Turkey.

The move drew condemnations from the Syrian government and Russia, as well as Syrian Kurds, who have been regarded as the United States’ most reliable and effective partner in the war against the Islamic State but now risk being usurped by their arch enemy, Turkey.

The offensive was spearheaded by Turkey, which sent tanks, troops and warplanes into Syria for the first time in the country’s five-year-old war, to help a force estimated to comprise between 1,000 and 1,500 Syrian rebels. U.S. advisers assisted the operation from inside Turkey, while U.S. warplanes conducted airstrikes alongside Turkish ones in support of the offensive, according to U.S. officials.

Jarabulus was the last of the once many Syrian-Turkish border crossings controlled by the Islamic State, and its loss will significantly curtail the flow of foreign fighters and supplies to its territories elsewhere, including its self-styled capital of Raqqa, said Col. John Dorrian, a U.S. military spokesman.

“Further setbacks in northern Syria continue to set the stage for the liberation of Raqqa,” he said.

Using the Arabic acronym for the Islamic State, he said, “Interdicting Daesh in Jarabulus reduces their ability to bring foreign fighters into Syria and Iraq, it reduces their ability to export terror from the region and makes it much more difficult to resupply and control terrain.”

The recapture of Jarabulus is just the latest in an expanding list of defeats inflicted on the militants, and their failure to defend it illustrates the Islamic State’s dwindling capacity to put up a fight, he added.

The capture of the town came a day after the group was ejected by Iraqi forces from the northern Iraq town of Qayyarah and just days after it lost control of the nearby Syrian town of Manbij, which was captured by the ­Kurdish-led Syrian Democratic Forces last week.

The presence of Turkish troops in Syria will also, however, raise the stakes in Syria’s war, recalibrating the battlefield in northern Syria and potentially pushing Turkey closer toward conflict with the U.S.-backed Syrian Kurds battling the Islamic State in the area.

Turkey has long warned that it will not tolerate continued Kurdish advances in northeastern Syria, and Turkish leaders stated that the dispatch of Turkish troops into the country was aimed as much at blunting Kurdish advances as rolling back the militants.

The Turkish incursion drew immediate criticism from Syria’s Kurds, who have made no secret of their ambition to forge a new autonomous Kurdish region in northern Syria adjoining the Turkish border.

One top Kurdish leader warned Turkey that it is entering a “quagmire” in Syria. “Turkey . . . will be defeated, as Daesh,” Saleh Muslim, the leader of the main Kurdish political party, the PYD (Democratic Union Party), said on his Twitter account.

Turkish President Recep Tayyip Erdogan responded that the Jarabulus operation was aimed as much at the Kurdish group as at the Islamic State, saying its target was “terror organizations such as Daesh and the PYD.”

“Those who have challenged Turkey should think about what will happen,” Erdogan added, referring to the PYD, in a speech at the presidential palace in Ankara.

Biden made it clear that the United States supports the Turkish presence in Syria. He delivered a blunt warning to the Kurds that the United States will not tolerate the creation of a separate Kurdish entity in northern Syria.

“No [Kurdish] corridor. Period. No separate entity on the border. A united Syria,” he said at a joint news conference with Turkish Prime Minister Binali Yildirim.

Biden also warned that unless the Kurds comply with a prior agreement with the United States to withdraw from the Syrian town of Manbij after capturing it, they will no longer receive U.S. support.

“They cannot, will not and under no circumstances will get American support if they do not keep that commitment. Period,” he said.

Biden’s threat could significantly curb the Kurds’ ambitions, which have been fueled by the support they have received from the U.S military. Manbij, an Arab city, lies to the west of the Euphrates River and had appeared to offer the Kurds a springboard that would enable them to link the areas of northeastern Syria already administered by Kurds with a separate Kurdish enclave farther west in the province of Aleppo, creating a vast Kurdish region that would also span many Arab areas.

U.S. Special Operations forces had joined in the battle for Manbij alongside the Syrian Kurds, on the condition that Kurdish forces would withdraw back across the river after the city was won — something that has not happened yet.

The deployment of Turkish troops in Jarabulus may have permanently thwarted the Kurdish goal, said Soner Cagaptay of the Washington Institute for Near East Policy.

“If the PYD was hoping to keep Manbij in its hands to use the city as a linchpin,” he said, “now this is a distant prospect for the Syrian Kurdish group.”

The Turkish deployment prompted an angry response from the Syrian government, which condemned the presence of Turkish troops as a “blatant violation” of Syrian sovereignty.

“What’s happening in Jarabulus now isn’t fighting terrorism as Turkey claims; rather it is replacing one type of terrorism with another,” said an unidentified Foreign Ministry official quoted by the official Syrian news agency SANA.

Russia also expressed concerns about the incursion, saying it was “deeply worried” by an offensive that may increase the possibility of civilian casualties and cause tensions between Arabs and Kurds, according to a statement from the Russian Foreign Ministry.

Sly reported from Beirut. DeYoung reported from Ankara. Heba Habib in Stockholm and Zakaria Zakaria in Istanbul contributed to this report.