ISTANBUL — Turkish troops and tanks crossed into Syria on Wednesday in support of a new U.S.-backed offensive against 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, 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 rebel fighter Ahmed al-Gader, using an acronym for Islamic State. “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 Joe Biden and seemed timed to demonstrate that Turkey and the United States remain close allies in the war against 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 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 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.

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 Islamic State's dwindling capacity to put up a fight, he added.

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 Islamic State in the area.

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.