PALM BEACH, Fla. — It didn't take long for President Trump to reach for the military option, and mostly for one reason: Gruesome photos of victims of a Syrian chemical weapons attack.

While he had criticized U.S. military action in Libya and Iraq during his presidential campaign, Trump decided to strike Syria less than 72 hours after first receiving horrifying reports of civilians choked to death by deadly sarin gas.

Facing the first major foreign policy test of his presidency, Trump told reporters gathered in Palm Beach, Fla., that he ordered a limited and targeted missile strike on the Syrian airfield from which he chemical attacks were launched. Trump said that years of previous attempts to change the behavior of Syrian dictator Bashar al-Assad "have all failed and failed very dramatically."

National Security Adviser H.R. McMaster said Trump was highly engaged in the Syrian attack since he was first notified about it. U.S. intelligence agencies quickly identified the source of the attack and the chemical agent used. “That confidence level has just continued to grow in the hours and days since the attack,” McMaster said.

The principals committee of the National Security Council met on Wednesday – the day after Trump reconstituted it with an executive order to remove political strategist Steve Bannon – and discussed three options. Trump quickly focused on two.

Trump discussed Syria during an Oval Office meeting Wednesday with King Abdullah of Jordan, which borders Syria and has borne the brunt of its exodus of refugees. Trump then told reporters at a news conference that the chemical attack was "unacceptable to me," and he stressed the deaths of "innocent people, including women, small children, and even beautiful little babies."

The president also spoke by phone Wednesday with at least two other key allies, German Chancellor Angela Merkel and Japanese Prime Minister Shinzo Abe.

On Thursday, Trump received an intelligence briefing before flying down to his Mar-a-Lago estate for a two-day meeting with Chinese President Xi Jinping. But before greeting the Chinese delegation, Trump held one last meeting, consulting national security officials who had traveled with him and others available by teleconference in Washington.

Trump made a final decision. “The president decided to act,” McMaster said.

The order was set in motion while Trump sat down for dinner with the Chinese president.

Rumors of an imminent military strike swirled across Washington. Vice President Pence returned to the White House shortly after dinner at home to huddle with aides. Officials stayed in contact with counterparts in Florida throughout the evening, sometimes using secure phones.

Along the way, Trump and aides kept allies in the loop. "I would tell you that the response from our allies, in Europe as well as the region and the Middle East, has been overwhelmingly supportive of the action we taken," Secretary of State Rex Tillerson told reporters late Thursday.

Not consulted, Tillerson said, were high-level Russian officials. "There were no discussions or prior contacts – nor have there been any since the attack – with Moscow,” he said. But U.S. forces did implement the so-called “deconfliction” agreement with Russian forces in the region in an effort to minimize Russian casualties.

“The purpose was not to seek permission. The purpose was to reduce the chance of Russian casualties,” said McMaster said.

Trump's dinner ended, and the Chinese delegation returned to their separate hotel. An hour later, as news organizations began to report the news out of the Pentagon, Trump stood at a lectern and confirmed the attacks.

"On Tuesday, Syrian dictator Bashar al-Assad launched a horrible chemical weapons attack on innocent civilians. Using a deadly nerve agent, Assad choked out the lives of helpless men, women, and children. It was a slow and brutal death for so many. Even beautiful babies were cruelly murdered in this very barbaric attack. No child of God should ever suffer such horror.

"Tonight, I ordered a targeted military strike on the airfield in Syria from where the chemical attack was launched," he said.

David Jackson reported from Washington.