ISTANBUL — 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 Islamic State border town but also adding a new layer of complexity to Syria’s already deeply complicated war.

By late afternoon, rebel units with the Free Syrian Army had swept into the center of the Syrian border town of Jarablus, 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. Photos 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 Jarablus. “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 Joseph Biden and seemed timed to demonstrate that Turkey and the United States remain close allies in the war against the Islamic State, despite the tensions that have erupted in their relationship since last month’s failed coup.

But the move also drew condemnations from the Syrian government, Russia and the Syrian Kurds, who until now 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.

Jarablus was the last of the many Syrian-Turkish border crossings once 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 U.S. military spokesman Col. John Dorrian.

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

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.