Bashar al-Assad has thanked Vladimir Putin and the Russian military for helping to save his country as the Russian president prepared to host the leaders of Iran and Turkey for high-level talks about ending the Syrian war. Mr Assad made a secret visit to Sochi on Monday, only his second trip outside of Syria since 2011, and met with Mr Putin for three hours to discuss a potential political settlement for Syria’s future. The Russian and Syrian leaders struck triumphant note as they assessed that the Syrian regime was moving “towards the final and inevitable defeat” of the Islamic State (Isil) and Syrian rebel groups. “I have conveyed to [Mr Putin], and on his behalf to the Russian people, our gratitude for Russia’s efforts to save our country,” said Mr Assad as he met with Russian generals, "In the name of the Syrian people, I greet you and thank you all, every Russian officer, fighter and pilot that took part in this war.” Mr Putin ordered Russian forces to intervene in Syria on Mr Assad’s behalf in late 2015. Over the course of two years of fighting, Russian forces and their Iranian allies have swung the tide of war decisively in Mr Assad’s favour. Russia's President Vladimir Putin (L) welcomes Syria's President Bashar al-Assad during a meeting at Bocharov Ruchei residence. Credit: Photo by Mikhail Klimentyev\\TASS via Getty Images With Isil almost entirely routed and with other Syrian rebel groups weakened and in disarray, Mr Assad and Mr Putin now feel confident enough to look beyond the combat stage and towards a future political agreement. “The main subject on the agenda is a peaceful and lasting political settlement in Syria after the routing of the terrorists,” Mr Putin said. Mr Assad said he was prepared to enter into serious peace talks. “We do not want to look back. We will accept and talk with anyone who is really interested in a political settlement.” The Kremlin said the two men had worked to “prepare the groundwork for possible understandings” that might be reached during a summit on Wednesday between Mr Putin, Iranian president Hassan Rouhani and Turkish president Recep Tayyip Erdogan. Iran and Russia have both supported the Assad regime throughout the war while Turkey has backed the opposition. The three countries have acted as guarantors of local deals in Syria and Mr Putin hopes they will be able to agree on a comprehensive pact to end the fighting. Syria's President Bashar al-Assad, Russia's President Vladimir Putin, and Russia's Defence Minister Sergei Shoigu (L-R) during a meeting at Bocharov Ruchei residence. Mr Putin has put himself at the centre stage of talks over Syria’s future. As well as hosting the Turkish and Iranian leaders, Mr Putin was due to speak Tuesday with both Donald Trump and King Salman of Saudi Arabia. Meanwhile, the Syrian opposition is due to meet today in Riyadh to try to agree a common position ahead of UN-brokered talks in Geneva next week. The Geneva talks have collapsed several times in the past and most observers agree it is more likely that the major decisions will be made by Russia, Iran and Turkey. Riyad Hijab, one of the main political opposition leaders and a former prime minister under Mr Assad, resigned unexpectedly on Monday. He gave no reason for stepping down but said "I find myself forced to announce my resignation". Syria war timeline The three countries have previously agreed to a series of “de-escalation zones” in Syria where fighting is supposed to be limited. In reality, both Russian and Syrian warplanes have continued bombing in the zones, especially in rebel-held areas in Idlib and Aleppo provinces. Around 50 people, most of them civilians, were killed in an airstrike in the town of Atareb last week. Palmyra recaptured Both Iran’s president and the leader of Hizbollah, the Lebanese militant group which has fought alongside the Syrian regime, declared victory over Isil this week after pro-regime forces seized control of Albu Kamal, the jihadists’ last major town in Syria. The Russian RBC newspaper quoted Kremlin sources saying that Russia hoped to finish its military campaign in Syria by the end of the year and reduce its personnel to a minimum at its Kheimim airbase and Tartus naval base.