ISTANBUL - Russia announced Tuesday that its units were patrolling between Turkish and Syrian military forces near the northern Syrian town of Manbij, in a sign that Moscow, a key ally of the Syrian government, was moving to fill a security vacuum after U.S. troops withdrew from the area.

The Russian Defense Ministry said in a statement that military police in northwestern Manbij were patrolling "along the line of contact between the Syrian Arab Republic and Turkey." A senior Russian official said Moscow was working to prevent a military confrontation between Ankara and Damascus.

"No one wants this kind of clash to happen. It's completely inadmissible. So, of course, we will not allow that," Alexander Lavrentyev, Russia's special presidential envoy for Syria, told reporters in the United Arab Emirates, according to the Interfax news agency.

Russia's announcement came as the United States said Tuesday that it has removed its own troops from Manbij. "Coalition forces are executing a deliberate withdrawal from northeast Syria," Col. Myles Caggins, a U.S. military spokesman, wrote on Twitter. "We are out of Manbij."

A week-old Turkish offensive into northern Syria has upended alliances and redrawn spheres of control in Syria's eight-year conflict. It has uprooted tens of thousands of civilians and sparked fears of resurgence by the Islamic State militant group. The Russian announcement on Tuesday laid bare another consequence: the withdrawal of the United States from at least part of Syria, as one superpower ceded influence to another.

As torch-passings go, it was almost clumsy. U.S. officials said they had "deconflicted" with their Russian counterparts as they withdrew. They left behind a military outpost that suggested a somewhat hurried exit, according to videos posted by smiling Russian soldiers and journalists who toured the place. Vehicles and weapons appeared to have been removed but a Game Boy, a refrigerator full of soft drinks and what appeared to be a few boxes of Krispy Kreme donuts remained.

A more consequential shift had occurred a day earlier, when the Syrian Kurds announced that they had struck an agreement with the government of President Bashar al-Assad - an act of desperation that ended a Kurdish experiment in self-rule, signed as the Turkish military closed in.

The deal would allow Syrian government forces to take over security in some border areas, according to Syrian Kurdish officials, who said their administration would maintain control of local institutions. Early Tuesday, Syrian state television reported that government troops have entered Manbij. It aired video footage of what it said were residents celebrating the arrival of Syrian forces in the center of town.

Ankara has said its military operation is aimed at clearing the border of Syrian Kurdish forces with links to Kurdish militants inside Turkey and repatriating Syrian refugees to the country.

The United States and other Western allies of Turkey have condemned the operation, warning that it could lead to the resurgence of the Islamic State militant group. The Trump administration on Monday called on Turkish President Recep Tayyip Erdogan to implement an immediate cease-fire and imposed sanctions on Turkey's defense and energy ministries, as well as on three senior Turkish officials.

President Donald Trump has been harshly criticized, including by some of his own Republican allies, for withdrawing U.S. troops and leaving the U.S.-allied Syrian Democratic Forces (SDF) to face the Turkish military. Vice President Pence announced Monday that he was leading a delegation to Turkey in the "immediate future" in an effort to end the violence.

Erdogan has given no indication he is willing to halt the offensive. "We will soon secure the region from Manbij to the border with Iraq," he said Tuesday during a visit to Azerbaijan, referring to a 230-mile expanse.

The offensive has raised questions about the future of towns and cities all along the border. On Tuesday though, the focus was on Manbij, a town 17 miles from the Turkish border that has been a focal point of Turkey's security anxieties as well as its troubled relationship with the United States.

Turkey had long demanded that the United States expel the SDF from Manbij and complained that a deal struck with Washington to remove the fighters was not being implemented.

Turkey and the United States agreed in December on a plan for the SDF to withdraw from Manbij, about 25 miles west of the Euphrates River, and a road map envisioned joint U.S.-Turkish patrols in the city. Turkish officials view the Kurdish fighters in Syria as terrorists because of their links to the Kurdistan Workers' Party (PKK), which has waged a decades-long war for autonomy inside Turkey.

Months of negotiations over Manbij were scuttled when Turkey began its military offensive last week.

Moscow, which has friendly ties with both the Syrian and Turkish governments, appeared uniquely positioned to prevent the two militaries from clashing around Manbij and elsewhere in Syria. At the same, Russia has made clear that it opposes Turkey's military operation. Lavrentyev, Russia's Syria envoy, said Tuesday that the offensive in Syria was "unacceptable."

"We have never favored and never supported the idea of sending, for instance, Turkish units there, not to mention Syrian armed opposition," he said, referring to the Turkish-backed rebel groups, according to Interfax.

Russia's principal interests in Syria include "mounting a successful defense of its Syrian ally in Damascus, restoring Damascus' writ and sovereignty over the entire territory of Syria, and then additionally reconciling the Syrian government with its regional and international surroundings," said Sam Heller, a senior analyst at the International Crisis Group. Russia's effort to normalize Syria's relationships have included promoting a 20-year-old agreement between Ankara and Damascus intended to address Turkey's security concerns - an accord that could eventually lead to restoring relations between the two governments.

But Turkey's plans to control a swath of Syrian territory, for an undetermined period of time, appeared to clash with Russia's aims. And despite Moscow's announcement Tuesday of peacekeeping efforts, fighting around Manbij continued, according to several reports.

A Kurdish official said Tuesday that scattered clashes occurred outside Manbij and that artillery fire from Turkey had struck the town. The Turkish-backed Syrian National Army said Tuesday that its forces had "started freeing villages" around Manbij a day earlier but had not entered.

Turkey said Tuesday that two of its soldiers were killed and eight others injured as a result of mortar and artillery fire by "terrorists" in Manbij, referring to the SDF.

Syrian government troops were mainly spread around the edges of Manbij, but Kurdish fighters still controlled the town, according to Abu Musafir, a member of the Manbij Tribal Council. The majority of ethnic Arab residents "were excited about the military operation led by Turkey and the Syrian National Army," he said, while at the same time worried about the return of the Syrian army.

The battles across Syria over the past week have taken a withering toll on civilians. The United Nations has said that as many as 160,000 people, including 70,000 children, have been displaced since the fighting in northeastern Syria escalated nearly a week ago. The Kurdish administration said Tuesday that as many as 275,000 internally displaced people are in the region.

The Kurdish Red Crescent said Monday that international aid groups have pulled their international staff from the northeast, leaving camps for displaced people with "extremely limited support."

Across the border in Iraq on Tuesday, exhausted Syrian Kurds said they had paid smugglers to get them out. Carrying few possessions - often no more than could be stuffed in a handbag - they had walked for hours in the darkness before trudging toward checkpoints, looking tired and stunned.

"I've spent so many years watching the tragedy of the refugees on the news. I never thought I could be one of them," said Rafat, 45, who arrived Monday at the sunbaked Domiz refugee camp. "My legs hurt, my calves hurt. We are all exhausted."

Although most had expected the offensive, its speed and scope had come as a shock.

"We were ready to stay in our houses. We really thought it would settle down," said Hevin Mohammed Hamcho, 29, who made the journey from the Syrian border town of Ras al-Ayn while eight months pregnant. "We thought the Americans would protect us, but then they just stepped back so quickly. We trusted them, and that's left us with nothing."

One family, unable to afford the smugglers’ fee, said they had packed onto two motorbikes and driven as fast as they could across the border. “The Peshmerga were shooting at us,” said Rasheed, 24, referring to the Kurdish security forces in Iraq. “We held tight and just kept going,” he said.