The accord caps a dramatic and swift transformation of the Syrian map unleashed by Trump's decision two weeks ago to remove the American soldiers.
U.S. troops in Syria fought five years alongside Kurdish-led forces in northeast Syria and succeeded in bringing down the rule of the Islamic State group there at the cost of thousands of Kurdish fighters' lives. Now much of that territory would be handed over to U.S. rivals.
The biggest winners are Turkey and Russia. Turkey would get sole control over areas of the Syrian border captured in its invasion, while Turkish, Russian and Syria government forces would oversee the rest of the border region. America's former U.S. allies, the Kurdish fighters, are left hoping Moscow and Damascus will preserve some pieces of their autonomy dreams.
Meanwhile, the Americans are stumbling out of Syria in a withdrawal that has proved chaotic, its extent and goals seeming to shift on the fly as they grasp to keep some influence on the ground.
In the latest hitch, Iraq's military said Tuesday the U.S. troops coming out of Syria do not have permission to stay in Iraq, contradicting U.S. Defense Secretary Mark Esper's statement a day earlier that they would remain there to fight the Islamic State group. Esper has also spoken of keeping some troops in eastern Syria to protect oil fields held by the Kurds.
Trump ordered the U.S. troop pull-out on Oct. 7 with little consultation with advisers and in the face of heavy criticism, even by Republican allies. It opened the way for Turkey to launch a long-threatened invasion of northeast Syria two days later to drive out the U.S.-allied Kurdish fighters. Vowing to get American soldiers out of the region and its "endless wars," Trump has said he sees no problem with Russia and Turkey taking over as power brokers.
The new accord was reached by Presidents Vladimir Putin of Russia and Recep Tayyip Erdogan of Turkey, after six hours of negotiations as they pored over maps of Syria in the Black Sea resort of Sochi.
"I believe that this agreement will start a new era toward Syria's lasting stability and it being cleared of terrorism. I hope that this agreement is beneficial to our countries and to our brothers in Syria," Erdogan said.
Under the 10-point deal, Kurdish fighters have 150 hours starting at noon Wednesday to withdraw from almost the entire northeastern border from the Euphrates River to the Iraqi border.
Russian and Syrian government forces would move in immediately to ensure the Kurdish fighters pull back 20 miles (30 kilometers) from the border. When the deadline expires on Oct. 29, joint Russian-Turkish patrols would begin along a 6-mile (10-kilometer) wide strip of the border.
The exception would be the region around the town of Qamishli at the far eastern end of the border, which has some of the densest Kurdish population. Russian and Turkish officials did not immediately say what the arrangement would be there.
Also, Turkey will keep sole control of the section in the center of the border that it captured in its invasion. It extends roughly 120 kilometers (75 miles) wide and 30 kilometers (20 miles) deep between the Syrian border towns of Tal Abyad and Ras al-Ayn.
A senior Kurdish official, Redur Khalil, confirmed his forces had entirely pulled out of that zone as required under a U.S.-brokered cease-fire.
That five-day-old pause in fighting expired on Tuesday evening, shortly after Khalil's announcement. There were no immediate reports of fighting resuming. But they traded accusations of violations down to its last moments.
Khalil said Turkish troops and their allies continued military operations in northeastern Syria outside that withdrawal zone.
Turkey's communications director, Fahrettin Altun, said just before the cease-fire expired that the fighters had not fully left. "The terrorists have another 15 minutes," he tweeted.
Turkey considers the Syrian Kurdish fighters as terrorists because of their links to Kurdish insurgents in Turkey. Erdogan had been infuriated by Washington's decision to ally with the Kurds against the Islamic State group, which empowered Kurdish self-rule ambitions. Erdogan has sought a "safe zone" along the border cleared of the fighters where Turkey could also settle many of the 3.6 million Syrian refugees currently on its soil.
The border region, however, is the heartland of Syria's Kurdish minority. Kurds have feared a Turkish takeover would not only crush their self-rule but cause massive demographic change, as Kurdish civilians flee and mainly Arab Syrian refugees move in.
The new agreement limits Turkish patrols — alongside Russians — to the areas closest to the border while putting the rest under Russia and its ally, the Syrian government. That may prevent a massive flight of civilians but would be a heavy blow to Kurdish autonomy dreams. Still, the Kurds continue to hold large territories further south, including strategic oil fields.
The deal is also a mixed bag for Syrian President Bashar Assad. It returns Syrian government control over parts of the border, but it also consecrates Turkey's hold on a large chunk.
Assad has vowed to reunite all the territory under Damascus' rule. Assad spoke to Putin by telephone after the deal was announced. Earlier Tuesday, Assad said he was ready to support any "popular resistance" against Turkey's invasion "to expel the invader sooner or later."
Erdogan is "a thief," Assad told troops during a visit to the northwestern province of Idlib. "He stole the factories and the wheat and the oil in cooperation with Daesh and now is stealing the land," he said, using an alternate acronym for the Islamic State group.
Assad's visit to Idlib underlined Damascus' goal of regaining the border. Idlib is adjacent to a border enclave that Turkey captured several years ago in another incursion. Turkey also has observation points inside Idlib, negotiated with Russia, to monitor a cease-fire there between the government and opposition fighters and jihadi groups.