Syrian President Bashar al-Assad flew to Moscow on Tuesday evening to thank Russia's Vladimir Putin personally for his military support, in a surprise visit that underlined how Russia has become a major player in the Middle East.
It was Assad's first foreign visit since the start of the Syrian crisis in 2011, and came three weeks after Russia launched a campaign of air strikes against Islamist militants in Syria that has also bolstered Assad's forces.
%shareLinks-quote="First of all I wanted to express my huge gratitude to the whole leadership of the Russian Federation for the help they are giving Syria." type="quote" author="Assad" authordesc="" isquoteoftheday="false"%
The Kremlin, which said it had invited Assad to visit Moscow, kept the visit quiet until Wednesday morning, broadcasting a meeting between the two men in the Kremlin and releasing a transcript of an exchange they had.
SEE ALSO: New York City police officer killed pursuing suspect in East Harlem
Putin said he hoped progress on the military front would be followed by moves towards a political solution in Syria, bolstering Western hopes Moscow will use its increased influence on Damascus to cajole Assad into talking to his opponents.
Assad's confidence is likely to be boosted by the visit, which comes as his forces wage counteroffensives in western Syria against insurgents backed by Assad's foreign opponent, as well as Islamic State militants.
"First of all I wanted to express my huge gratitude to the whole leadership of the Russian Federation for the help they are giving Syria," Assad told Putin.
"If it was not for your actions and your decisions the terrorism which is spreading in the region would have swallowed up a much greater area and spread over an even greater territory."
Russian officials have repeatedly said they have no special loyalty for the Syrian leader, but his audience with Putin will be seen in the West as yet another sign the Kremlin wants Assad to be part of any political solution, at least initially.
The visit also suggests that Russia, and not longtime ally Iran, has now emerged as Assad's most important foreign friend.
Russian state TV made the meeting its top news item, showing Assad, dressed in a dark blue suit, talking to Putin, together with the Russian foreign and defense ministers.
The Kommersant daily cited unnamed sources saying meetings between the two delegations had lasted over three hours. The Syrian presidency Twitter account said Assad and Putin held three rounds of talks - one of them a closed meeting and the other two including Russia's foreign and defense ministers.
The Kremlin has cast its intervention in Syria, its biggest in the Middle East since the 1991 Soviet collapse, as a common sense move designed to roll back international terrorism in the face of what it says is ineffective action from Washington.
See photos of the meeting:
It is likely to use Assad's visit to buttress its domestic narrative that its air campaign is just and effective and to underline its assertion that its actions show it has shaken off the Ukraine crisis to become a serious global player.
Russia has a combined force of around 50 jets and helicopters in Latakia protected by Russian marines. It also has military trainers and advisers working with the Syrian army.
Russia's air force says it has flown over 700 sorties against more than 690 targets in Syria since Sept. 30.
Assad, who looked relaxed, emphasized how Russia was acting according to international law, praising Moscow's political approach to the Syrian crisis which he said had ensured it had not played out according to "a more tragic scenario."
Ultimately, he said, the resolution to the crisis was a political one.
"Terrorism is a real obstacle to a political solution," said Assad. "And of course the whole (Syrian) people want to take part in deciding the fate of their state, and not just the leadership."
ALSO READ: Texas teen arrested over clock is moving to Qatar with his family
Putin said Russia was ready to help find a political solution and hailed the Syrian people for standing up to the militants "almost on their own", saying the Syrian army had notched up serious battlefield success in recent times.
Sergei Shoigu, his defense minister, said Russia's air support had helped the Syrian army move from defense to attack, saying Moscow would continue to provide military support.
Putin said Russia had felt compelled to act in Syria because of the threat Islamist militants fighting Assad's forces there posed to its own security.
"Unfortunately on Syrian territory there are about 4,000 people from the former Soviet Union - at a minimum - fighting government forces with weapons in their hands," said Putin.
RELATED: See Russian airstrikes in Syria
"We, it goes without saying, can not allow them to turn up on Russian territory after they have received battlefield experience and undergone ideological instruction."
Positive developments on the military front in Syria would provide a basis for a long-term political solution, involving all political forces, ethnic and religious groups, said Putin.
"We are ready to make our contribution not only in the course of military actions in the fight against terrorism, but during the political process," he said, according to the transcript released by the Kremlin.
"This will, of course, be in close contact with other world powers and with countries of the region which are interested in a peaceful resolution of the conflict," Putin said.
Interfax news agency said Putin briefed Turkish President Tayyip Erdogan by phone about the talks. Turkey, which supports rebels trying to overthrow Assad, said the Syrian leader should have stayed in Moscow for the sake of his country.
When asked whether Assad's own political future had been discussed, Putin's spokesman declined to comment.
How Assad got to and back from Moscow remains a mystery.
Syria's ambassador to Russia, Riad Haddad, told Reuters Assad had traveled in a Syrian plane and had safely returned home after the meeting. But publicly available flight tracking data suggested Assad's hosts may have laid on transport for him.
It showed an IL-76MD Russian military cargo plane flew from Syria to Moscow's Chkalovsky military airfield on Tuesday, and that an IL-62M plane from Russia's presidential fleet flew to Latakia, a government controlled Syrian province, that same evening.
More from AOL.com:
UK rolls out red carpet for China's Xi on contentious visit
12 years after girl strayed into Pakistan, woman going home
How serious is Donald Trump? His campaign lacks one essential tool