Russia and Turkey have a crucial role to play in resolving the conflict in Syria, President Vladimir Putin told his Turkish counterpart Recep Tayyip Erdogan, a day after their countries agreed to coordinate military steps following the U.S. decision to withdraw its forces.

In a New Year's message to Erdogan published by the Kremlin on Sunday, Putin said that "Moscow and Ankara are making a decisive contribution to the fight against terrorism in Syria, as well as to the promotion of a political settlement in that country."

His comment came a day after the Russian and Turkish foreign and defense ministers, as well as the countries' intelligence chiefs, held talks in Moscow on Syria as they move to fill the void left by President Donald Trump's decision to order a military pullout.

"We reached an agreement on how Russian and Turkish military representatives on the ground will continue to coordinate their actions in these new conditions, with the goal of decisively defeating the terrorist threat in Syria," Russian Foreign Minister Sergei Lavrov told reporters after the talks. The two countries have a "common will to clear Syrian territories of all terrorist groups," Turkish Foreign Minister Mevlut Cavusoglu said.

Russia said Saturday that Syrian government forces have taken control of Manbij, a strategic town close to the border with Turkey that had been under the command of a U.S.-backed Kurdish militia before Trump announced his withdrawal.

On Friday, the U.S.-led coalition had denied what it called "incorrect" information about changes to the presence of military forces in Manbij. The Turkish army was threatening an offensive to eliminate the presence of Kurdish YPG fighters from the town, saying it's a terrorist organization linked to Kurdish separatists inside its own borders.

New order in Syria

Russia and Turkey have been maneuvering to position themselves for a new order in a Syria without a U.S. military presence. Trump announced the withdrawal on Dec. 19 after a phone call with Erdogan, prompting the departure of Secretary of Defense Jim Mattis in protest.

German Chancellor Angela Merkel told Erdogan in a phone call Sunday that she expects Turkey to react with "restraint and responsibility" following the U.S. withdrawal, according to a German government spokeswoman. Merkel praised Turkey for taking in Syrian refugees.

While ISIS has been pushed back thanks to coordinated efforts, the group remains a significant threat that warrants further attention, the spokeswoman said in a statement. Erdogan and Merkel discussed the fight against terror and the issue of migrants moving toward Europe, Turkey's state-run Anadolu Agency reported, citing the presidency.

Russia has said the Syrian government should retake areas vacated by the U.S., but also joined Trump in endorsing a role for Turkey in continuing the fight against ISIS.

The meeting in the Russian capital came at a delicate time for Moscow and Ankara, which have built strong ties even as they backed opposing sides in Syria's eight-year civil war. The U.S. withdrawal risked a crisis in the relationship, as Turks prepared to take over Manbij while their Kurdish adversaries sought help from Syrian President Bashar Assad's regime, which is backed by Russia.

In a New Year's message to Assad, Putin said Russia "will continue to provide all possible assistance" to Syria in "the fight against the forces of terrorism, in defense of state sovereignty and territorial integrity."

The U.S.-led forces fighting ISIS in Syria armed the YPG, and Trump's decision to exit Syria has left them vulnerable to Turkey. Ankara says the group is an extension of the Kurdish PKK that it's been fighting for more than three decades, and which is designated as a terrorist organization by Turkey, the European Union and the United States.