In a flash, President Trump’s missile strike on Syria conveyed America’s moral outrage over the slaughter of innocents and delivered a lethal warning to two-bit tyrants everywhere.

The attack did something else, too. It punched a giant hole in the battered legacy of Barack Obama.

The former president talked early and often about Syria, but wasted six years and countless lives with hand-wringing dithering. He failed to enforce his red line about Bashar al-Assad’s use of chemical weapons, kicking the job to Trump, who acted just two days after Assad again unleashed fiendish weapons on his own people.

The contrast on Syria was one of several events that made Obama a big loser last week. Another one was the growing evidence that his team spied on Trump’s for political reasons.

The confirmation of Neil Gorsuch to the Supreme Court illustrated the importance of Republicans holding the Senate and winning the White House as part of the nationwide rejection of Obamaism.

Yet as measured by the loss of life and global impact, nothing compares with Obama’s failure in Syria. His refusal to lift a finger opened the door to perhaps the largest humanitarian crises since World War II.

The United Nations estimates that out of a prewar population of 22 million Syrians, 500,000 are dead, more than 6 million are displaced within the country and nearly 5 million more are refugees scattered around the world.

Nearly a million are in Germany alone, and their presence elsewhere in Europe, Turkey, Iraq, Jordan and Greece is causing enormous social and political divisions. Both Brexit and Trump’s election were fueled in part by the unchecked flood of refugees.

Talking about his legacy before he left office, Obama confessed to historians that the Syrian bloodbath was his biggest regret. “He himself told me, when I interviewed him, that that was the decision that haunted him the most,” Doris Kearns Goodwin told Time magazine. “Not that he had had two decisions and made the wrong one, but he said maybe there was some other decision out there that he didn’t have the imagination or the inventiveness to figure out.”

His defense is typical Obama sophistry. In fact, he did make a decision — he decided not to act after vowing he would. His choice left a leadership vacuum filled alternately by butcher Assad, Islamic State, Russia, Iran and Hezbollah, a toxic brew with horrific consequences that will go on for years.

Obama’s infamous blinking on Assad’s use of chemical weapons came in 2013, but back in 2011, when the Syrian civil war was young, the president declared, “The time has come for President Assad to step aside.”

Yet Obama never turned that declaration into a policy with teeth. Hyped plans to arm anti-government rebels came and went repeatedly, despite his advisers favoring them.

In their place, the White House substituted tough talk about a “red line” over chemical weapons, with then-Secretary of State Hillary Clinton using the words in August 2012, and Obama using them for the first time nine days later.

When reports said Assad had used chemical weapons in March 2013 near Aleppo, Obama said it would be a “game changer,” but added he didn’t want to act until he was certain, then let the incident pass without action.

In August that year, Assad used chemical weapons again, and the US and France were said to be preparing airstrikes. But then Russia proposed a deal for its ally: Syria would send its stockpiles out of the country for destruction, an offer Obama immediately embraced.

In short order, Syria surrendered more than 600 metric tons of chemicals, which supposedly represented everything Assad had.

Indeed, Obama’s national security adviser, Susan Rice, still boasted about the deal three months ago, claiming, “We were able to find a solution that didn’t necessitate the use of force that actually removed the chemical weapons that were known from Syria, in a way that the use of force would never have accomplished.”

Obviously, the deal was a head-fake that Obama fell for, as Assad’s use of sarin gas last week proved. In truth, the ex-president got what he wanted — an excuse not to use military force and to leave the problem for his successor.

That would be dereliction enough, but the ripples were just getting started. Vladimir Putin saw Obama’s fecklessness as an opening and in the fall of 2015, sent Russian military units and aircraft to help Syria’s depleted troops.

Equally important, Russia secured bases and a firm foothold in a region from which it had largely disappeared because of American dominance.

And the instant Obama’s nuclear deal with Iran was finalized in September 2015, Qasem Soleimani, the leader of Iran’s elite Quds Force, was spotted in Moscow, meeting with Putin about cooperation in Syria. Within a month, they launched an offensive that included Iranian, Russian and Syrian troops.

Syria is now a global flashpoint, and even if Assad keeps his chemical weapons in storage, the wholesale slaughter of civilians continues and the risk of a wider conflict is growing.

Obama has been silent about Trump’s strike, but his legacy speaks for him. Recall that Rice and others who insisted Assad surrendered all his chemical weapons also swear that Iran, because of Obama’s deal there, won’t get nuclear weapons.

This is the burning world Trump inherited, and the worst is yet to come.