Updated

Russia's military intervention in Syria has deepened the sense that President Bashar Assad may survive the country's disastrous civil war, and his surprise visit to Moscow — a first foray out in nearly five years — underscores how emboldened the Syrian leader has become.

The show of force by the two allies is a challenge to a U.S. administration whose response on Syria is widely seen in the region as inconsistent and chaotic.

Whether it is also part of a quiet Russian push to engineer a political transition in Syria on President Vladimir Putin's terms is yet to be seen. Such a scenario would do wonders for the Russian leader's evident ambition to seize center stage in world affairs.

Hours after Assad's visit was announced Wednesday, Russia confirmed Foreign Minister Sergei Lavrov and U.S. Secretary of State John Kerry had agreed to meet in Vienna on Friday with their Turkish and Saudi counterparts to discuss the Syrian conflict.

Either way, the visit shows remarkable resilience that Assad was able to leave Syria without fear of a coup or arrest after presiding over a rare descent into hell: Half the country's population has been displaced, at least a quarter million people have been killed and Islamic State militants are in control of large swaths of territory.

Even as vast parts of his country fell from his control or turned into killing fields, Assad has kept his regime core in place and continues to hang on to strategic territory that remains firmly under his rule.

Here's a look at how Assad has come this far:

DETERMINED PERSONA

In five years of civil war, Assad has never once wavered from his calm, confident public persona as a man fighting to protect Syria from al-Qaida-type Islamic extremists bent on destroying the country. Using a mixture of brute force and a consistent portrayal of the conflict as a war on terror, the 50-year-old former eye doctor has defied every prediction that his end is near.

His forces' use of military might against mostly peaceful protesters early in the conflict quickly earned him near-pariah status. Yet Assad was unflinching in sticking to his narrative, and often appeared fueled by an unshakeable belief that Syria would collapse without him.

Before the uprising erupted, Assad had cultivated an image of himself as a nationalist hero fighting Western imperialism and ensuring stable, secular rule in a turbulent region wracked by sectarian wars. That allowed him to rally support that stretched beyond his minority Alawite base. He still retains a significant amount of support from Alawites and other minority sects who view him as a bulwark for ensuring their survival in the face of the Sunni-led rebellion.

___

FRIENDS LIKE THESE

The fact that Assad has survived the war is largely due to powerful allies Iran and Russia, which have used political, financial and military means to shore up his forces. Their unswerving support is in sharp contrast to the muddled response by the U.S. administration, and has injected a self-assurance that Assad would not be allowed to fall like other Arab dictators who were either imprisoned or killed.

Assad flashed wide smiles as he shook hands with Putin and other officials in Moscow on Tuesday. "We thank you for standing by Syria's territorial integrity and its independence," Assad told Putin.

The two allies have gradually ramped up their support of Assad throughout the conflict, especially at times when his forces appeared to be nearing collapse.

Iran has devoted millions of dollars' worth of aid to propping up the Syrian army and funding Iranian-backed militias, especially Lebanon's Hezbollah, to fight alongside Assad. It also sent military experts and advisers to the country and recently began deploying hundreds of Revolutionary Guards to fight alongside government forces.

Russia has consistently used its veto power at the U.N. Security Council to shield Assad and last month began airstrikes in Syria following significant territorial losses by government forces to the rebels. That has allowed the government to launch multiple offensives on several fronts and make small but steady advances in several areas across the country.

___

CHEMICAL WEAPONS DEAL

The agreement reached by the U.S. and Russia in September 2013 under which Assad would give up his chemical weapons arsenal gave a major boost to the Syrian leader. The last minute agreement averted U.S.-led strikes against the Syrian government as punishment for a deadly chemical weapons attack in Damascus on August 21, 2013, something that President Barack Obama had declared would be a "red line."

The deal provided that Assad would declare and hand over Syria's chemical weapons stockpile for destruction. Although he has done that, Assad's forces have been blamed for dropping barrel bombs containing chlorine and other toxic agents on civilian areas. Critics say the deal encouraged Assad to continue carrying out chemical attacks which are harder to prove, and to continue acting with impunity.

___

ISLAMIC STATE ADVANCES

The rise of Islamic extremists in Syria, including the Islamic State group with its spectacular atrocities, has eclipsed the wider civil war and shifted attention away from Assad. By reducing the discourse on Syria to the battle against IS, many charge that the West has served Assad's interests and reinforced his narrative about the conflict being driven by Islamic extremists.

Many critics also charge that Assad purposely facilitated and fueled the extremist surge to cling to power, by releasing Islamist prisoners in the early days of the war. If that was the plan, it succeeded in convincing many observers that his remaining in power is the least-bad option.