Russian President Vladimir Putin praised his U.S. counterpart Donald Trump on Thursday for deciding to withdraw American troops from the battlefield in Syria, alleging that the Islamic State (ISIS) terrorist group has been defeated and thus there is no compelling reason for American military action there.

Putin made his remarks during a three-hour-long press conference touching on a variety of topics, a practice that has become an end of year tradition for the Russian leader.

“I agree with the U.S. president by and large,” Putin told reporters, according to Russian news agency TASS. “We’ve achieved considerable changes in the struggle against terrorism in that area and dealt severe blows to the Islamic State in Syria.”

Putin went on to say that an American presence in Syria is “not necessary” and “not legitimate,” since dictator Bashar al-Assad did not invite American troops to participate in the civil war there. “Let us not forget that the presence of U.S. troops in Syria is not legitimate … a military contingent can stay there only under a U.N. resolution or at the invitation of Syria’s legitimate government.”

“If it is true that it has made a decision to pull out its military contingent, it is correct,” Putin concluded.

Putin attempted to contrast the presence of U.S. troops in Syria with that of the Russian troops, insisting that Russia has a compelling reason to stay in Syria because Islamic State terrorists fleeing the Syrian battlegrounds could reach countries like Afghanistan, where they would be perilously close to the Russian border. “That is a major threat for all of us,” Putin noted.

The Syrian Civil War began in 2011 after Assad, an Alawite Shiite Muslim, began using state violence to suppress protests against his continued leadership of the country. While once fought between Assad’s forces and Syrian rebels, many of which are Sunni Arabs, the war attracted international attention resulting in the creation of the Islamic State, formerly al-Qaeda in Iraq and Syria.

ISIS, rather than fighting on either side of the war, chose to begin attempting to establish an Islamic caliphate in conquered territory, establishing their “capital” in Raqqa. In Syria’s north, the Kurdish People’s Protection Units (YPG) took on the role of fighting ISIS, trying to protect their land from invasion. The Turkish military allegedly entered Syria to “end the rule of the tyrant Assad,” but has subsequently focused all its effort on fighting the YPG. Assad’s main international allies, Russia and Iran, entered the war to fight the rebels and keep Assad in power, alleging instead that they were fighting ISIS.

The United States has participated in the Syrian Civil War against the Islamic State, using the legality of the congressional Authorization for Use of Military Force (AUMF) signed against al-Qaeda following the September 11, 2001, terrorist attacks.

President Trump stated on Wednesday that, with ISIS defeated – mostly at the hands of the YPG, who liberated Raqqa with other allied members of the Syrian Defense Forces (SDF) – there is no legitimate reason for American forces to remain in the country.

“Getting out of Syria was no surprise. I’ve been campaigning on it for years, and six months ago, when I very publicly wanted to do it, I agreed to stay longer,” Trump said in remarks on Twitter Thursday. “Russia, Iran, Syria, and others are the local enemy of ISIS. We were doing there work. Time to come home and rebuild.”

Trump also claimed that Russia was “not happy” about the U.S. withdrawal in Twitter remarks published shortly after Putin stated that he agreed with the decision.

Prior to his remarks confirming his approval on Thursday, Putin had told reporters that Russia aspired to “pursue a goal that there would be no foreign forces” in Syria, referring to the United States and Turkey.

Follow Frances Martel on Facebook and Twitter.