President Donald Trump's surprise decision to withdraw forces from Syria presented a rare and unmistakable victory for Russian President Vladimir Putin, whose relationship with the Trump administration has been anything but predictable.

With the departure of US troops, Moscow would become the undisputed international power broker in the war-torn country and win an opportunity to consolidate a countrywide victory for its ally, Syrian President Bashar Assad.

The frenzied and disorganised nature of the US withdrawal announcement – in leaked remarks to the news media followed by a terse tweet and a slapdash soft-focus video shot on the White House lawn – also bolstered Mr Putin's efforts to undermine Washington's network of alliances.

In comments on Thursday, the Russian president hailed the US decision as "correct," agreeing with Mr Trump that the Islamic State had been largely defeated.

"On this, Donald is right. I agree with him," Mr Putin said on Thursday.

Mr Trump stunned US allies by ordering the withdrawal of US forces and contradicted US diplomats and military officers who as recently as last week said the United States would remain in Syria to finish off the Islamic State.

For Mr Putin, who himself has been dismayed by the Trump administration's frenetic application of sanctions against Moscow and one-off military strikes in Syria, the chaos of the president's governing style landed decisively in his favour.

"The Kremlin is of two minds when it comes to Trump: It hates the unpredictability and lack of coordination coming out of this White House but totally loves the chaos Trump is unleashing," said Andrew Weiss, a Russia scholar at the Carnegie Endowment for International Peace. "Anything that damages America's alliances and image of a steadfast, reliable partner is a net win for Moscow."

Mr Trump's broadsides against allies and lack of interest in building international consensus ahead of major policy changes have injected a level of doubt into the country's alliances that were largely unseen in the post-war era.

Many of the United States' most important allies, from Europe to Asia, were reassured by the presence of Defence Secretary Jim Mattis, who has publicly made strengthening American alliances a central platform of his tenure at the Pentagon.

But the sudden decision this week about a withdrawal from Syria left the Pentagon chief with little time or rationale to reassure allies. His announcement on Thursday that he would resign is likely to raise concerns about the Trump administration's commitment to allies' security and interests as the president seeks to find a replacement for Mr Mattis.

Donald Trump's reaction as he sees Vladimir Putin at WW1 Remembrance service reveals a lot

In Germany, which is part of the US-led coalition, Foreign Minister Heiko Maas said Mr Trump's decision was a surprise.

"There is a risk that the consequences of this decision will harm the fight against IS and endanger the achievements that have been made," Mr Maas said in a statement, referring to Isis.

France said it would keep its contingent of about 1,000 troops in Syria for now because Isis had not been fully defeated, raising the prospect of further divisions in the US-organised alliance that is fighting the extremist group.

"Daesh had not been cleared off the map, nor, for that matter, have its roots been cleared. The last pockets of this terrorist organisation must be beaten in a definitive manner by military means," French Armed Forces Minister Florence Parly tweeted, using an Arabic acronym for Isis.

Britain, the most active partner to the United States in the fight against Isis, did not break publicly with Washington, but its officials were blindsided by the announcement.

British Secretary of State for Defence Gavin Williamson contradicted Mr Trump's contention that the battle against Isis had been won, saying in a tweet on Thursday that "much hard work still lies ahead to ensure we win the war."

Mr Trump has defended the move, tapping into widespread public disenchantment with years of costly and protracted American military operations in the Middle East and South Asia that have not delivered victories, even though few dispute the success and progress of the campaign against isis.

"Does the USA want to be the Policeman of the Middle East, getting NOTHING but spending precious lives and trillions of dollars protecting others who, in almost all cases, do not appreciate what we are doing?" Mr Trump tweeted on Thursday. "Do we want to be there forever? Time for others to finally fight."

Critics accused Mr Trump of ignoring the threat a reconstituted Isis poses to the United States and its allies in the event of a hasty and chaotic US withdrawal.

The cacophony among US allies, analysts said, is likely to please Mr Putin, who has long sought to chip away at Western unity. But in the short term, the Kremlin stands to gain the most on the ground in Syria, where Russia has long been seeking to consolidate gains for Mr Assad.

The confusion between the United States and its closest allies backs the message Mr Putin has been sending to Russia's partners in the Middle East: that Russia is an ally that can be trusted and one that will fight until the end.

Russia has stuck by Mr Assad despite mounting international pressure and multiple rounds of sanctions, seeing the Syrian government as a loyal client in the Middle East and preferring a strongman ally to a country in disarray.

Russia helped turn the tide in Syria's civil war after intervening in 2015 with airstrikes to back Mr Assad. It was the first time since the fall of the Soviet Union that Russia had engaged on a large scale in a war outside the former Soviet borders.

Who could be running against Trump in 2020? Show all 23 1 /23 Who could be running against Trump in 2020? Who could be running against Trump in 2020? Joe Biden The former vice president - poised to be a frontrunner - has announced his run. He recently faced scrutiny for inappropriate touching of women, but was thought to deal with the criticism well AFP/Getty Who could be running against Trump in 2020? Bernie Sanders The 2016 runner-up has announced that he will be running again in 2020 Getty Who could be running against Trump in 2020? Hillary Clinton The 2016 Democratic presidential candidate and former Secretary of State says she is “still considering” whether she will run again. Getty Who could be running against Trump in 2020? Pete Buttigieg The Indiana mayor and war veteran will be running for president. If elected, he would be the first openly LGBT+ president in American history. Getty Who could be running against Trump in 2020? Kamala Harris The former California attorney general will be running for president in 2020. Introduced to the national stage during Jeff Sessions’ testimony, she has endorsed Medicare-for-all and proposed a major tax-credit for the middle class. AP Who could be running against Trump in 2020? Elizabeth Warren The Massachusetts Senator has formally launched her bid for president in 2020. A progressive Democrat, she is a major supporter of regulating Wall Street. AP Who could be running against Trump in 2020? Beto O’Rourke The former Texas congressman told Oprah Winfrey that he “has been thinking about running for presidency”, but stopped short of formally announcing his bid to run in 2020. AFP/Getty Who could be running against Trump in 2020? Wayne Messam Mayor of the city of Miramar in the Miami metropolitan area, Wayne Messam has announced his bid. He intends to run on a progressive platform against the "broken" federal government. He favours gun regulations and was a signatory to a letter from some 400 mayors condemning President Trump's withdrawal from the Paris Climate Accord. Vice News Who could be running against Trump in 2020? Kirsten Gillibrand The New York Senator formally announced her presidential bid in January, saying that “healthcare should be a right, not a privilege.” Getty Who could be running against Trump in 2020? Cory Booker The New Jersey Senator has announced that he will be running for the presidency in 2020. If he secures the nomination he said finding a female vice president would be a priority. Getty Who could be running against Trump in 2020? John Delaney The Maryland congressman was the first to launch his bid for presidency, making the announcement in 2017. AP Who could be running against Trump in 2020? Julian Castro The former San Antonio mayor announced his candidacy in January and said that his running has a “special meaning” for the Latino community in the US. Getty Who could be running against Trump in 2020? Tulsi Gabbard The Hawaii congresswoman announced her candidacy in January, but is likely to face tough questions on her past comments on LGBT+ rights and her stance on Syrian President Bashar al-Assad. Getty Who could be running against Trump in 2020? Andrew Yang The entrepreneur has announced his presidential candidacy, and has pledged that he would introduce a universal basic income of $1,000 a month to every American over the age of 18. AFP/Getty Who could be running against Trump in 2020? Marianne Williamson The author and spiritual advisor has announced her intention to run for president. She had previously run for congress as an independent in 2014 but was unsuccessful. Getty Who could be running against Trump in 2020? John Kerry The former secretary of state has said he is still thinking about whether to run. Getty Who could be running against Trump in 2020? Michael Bloomberg The entrepreneur and former New York mayor– with a net worth of around $50bn – has said he will decide by the end of February whether to seek the presidency. AFP Who could be running against Trump in 2020? Howard Schultz Former Starbucks CEO Howard Schultz has not yet ruled out running for president in 2020, despite criticism that his bid could help re-elect Mr Trump by dividing the Democrat vote. AP Who could be running against Trump in 2020? Eric Holder The former attorney general has said he will decide in “the next month or so” whether to run as a 2020 presidential candidate. AP Who could be running against Trump in 2020? Eric Swalwell The California congressman said he is “ready to do this” and will decide before April whether to run. MSNBC Who could be running against Trump in 2020? Terry McAuliffe The former Virginia governor, who worked to elect Democratic governors during 2018 midterms, said there was a “50 per cent” chance he would run. AP Who could be running against Trump in 2020? Sherrod Brown The Ohio senator is still undecided about whether to run for president in 2020. Who could be running against Trump in 2020? Mitch Landrieu The former New Orleans mayor said he doesn’t think he will run for president, but “never say never”. AP Photo/Jacquelyn Martin

For Mr Putin, analysts say, the significance was manifold. Propping up Mr Assad was a message to the West that leaders cannot be deposed by outside force - an attempt Mr Putin is believed to fear the West is trying to orchestrate in Russia. The military campaign was also a way for Russia to re-establish influence in the Middle East, show off its reconstituted military might and help brand itself a resurgent great power.

"Russia has become the major power broker in the Middle East," said Angela Stent, a Russia expert at Georgetown University. "It's the only major power that talks to the Shia states, the Sunni states, Israel, Hamas, Hezbollah and the Kurds. The only difference between now and the Soviet days is that Russia approaches issues non-ideologically."

The Russian military presence in Syria includes a naval base in Tartus and an air base in Hmeimim. Russia plans to forge ahead in talks with Turkey and Iran to find a political settlement for the conflict, a prospect Moscow sees as more likely and favourable now that the United States may be out of the picture.

Mr Putin on Thursday seemed to try to avoid taking too much of a victory lap, describing a US withdrawal as the "right" decision if it actually happens. Russia says the US deployment to Syria has always been illegal because it lacked a mandate from the Assad government or the United Nations.

The Russian president lauded Mr Trump for his analysis that Isis has been defeated, though analysts and US military commanders say the militant group remains a deadly force. Isis, Mr Putin said, had already been dealt "serious blows."

The disruption in the US alliance over the withdrawal decision touches on a long-term goal of Mr Putin's.

In a 2007 speech in Munich, Mr Putin famously decried a unipolar world led by the United States as unfair and called a geopolitical arena with one master pernicious for nations within its system.

Since then, the Russian leader has sought to re-establish Moscow as a global power and undermine faith in democratic ideals and alliances that have given Washington its military and economic might since the Cold War.

"One state and, of course, first and foremost the United States, has overstepped its national borders in every way," Mr Putin said in 2007. "This is visible in the economic, political, cultural and educational policies it imposes on other nations."