Peter Bergen is CNN's national security analyst, a vice president at New America and a professor of practice at Arizona State University. Portions of this article are adapted from Peter Bergen's new book " Trump and His Generals: The Cost of Chaos ," which is published Tuesday. The opinions expressed in this commentary are his own. View more opinion articles at CNN.

(CNN) The FBI is treating Friday's shooting at the Naval Air Station in Pensacola, Florida, in which three US sailors were killed as an "act of terror."

This makes the alleged shooter, Saudi Air Force officer Mohammed Alshamrani, the first foreign national to carry out a lethal terrorist attack in the US since 9/11.

Every other lethal jihadist terrorist attack in the United States since 9/11 has been carried out by a US citizen or legal permanent resident, according to New America , a research institution.

President Donald Trump's reaction to the attack in Pensacola was uncharacteristically subdued, and he hasn't characterized it as act of terrorism even though the FBI is treating it as such. Trump spoke to Saudi Arabia's King and to its Crown Prince and said, "They are devastated by what took place in Pensacola. And I think they're going to help out the families very greatly."

Do this thought experiment: What if the Pensacola shooter wasn't a Saudi but instead a national of a country such as Yemen that is on the Trump "travel ban" list of seven largely Muslim-majority countries whose citizens are subject to "extreme vetting." Trump would be crowing about his travel ban , as he has in recent weeks when he has invoked it several times at campaign rallies, claiming that it has made the US safe from terrorists.

Saudi Arabia is not on the travel ban list, despite the fact that 15 of the 19 hijackers who killed nearly 3,000 people in America on 9/11 were Saudis.

The Pensacola attack reminds us that Trump, even more than his predecessors, has gone all in with the Saudis, defending their controversial war in Yemen and blockade against Qatar and continuing to support the regime after a US-based journalist critical of the government was murdered in a Saudi consulate. Trump has been particularly consistent in defending Saudi Crown Prince Mohammed bin Salman, widely known as MBS.

How the 'bromance' began

A snowstorm helped to seal the alliance between the House of Saud and the House of Trump. Only seven weeks into the Trump administration, on the morning of March 14, 2017, the Saudis' then-deputy crown prince, Mohammed bin Salman, was scheduled to meet briefly with President Trump at the White House.

After that, the President was supposed to have lunch with the German Chancellor Angela Merkel, but a massive snowstorm was making its way across the northeast of the United States, resulting in more than a thousand flight cancellations at the three Washington-area airports.

Merkel was already close to the airport in Germany, waiting to take off for the United States and insisted she wanted to hear from Trump himself if her trip was going to be put off, according to a Trump administration official. So, Trump called Merkel, telling her, "I really hate to postpone, but this storm is huge."

The postponement of Merkel's trip meant that the brief meeting between Trump and Mohammed bin Salman was extended to include a formal lunch with the President and key members of his Cabinet, which was quite an honor for the 31-year-old prince.

MBS's father, then-81-year-old King Salman, was monarch in name, but it was clear that his youngest and favorite son was the emerging center of power in the Saudi kingdom.

Both the scions of wealthy families and only a few years apart in age, MBS and Trump's son-in-law Jared Kushner bonded over a belief that together they could transform the Middle East. MBS approached his courtship of Kushner with considerable ardor. Kushner once mused, "Mohammad bin Salman rushed me in ways that no woman had ever rushed me," an observation that I learned from a Trump administration source and is reported here for the first time.

The Saudis understood the power of family relationships and an alliance with Trump made intuitive sense to them, particularly after their tense relationship with President Barack Obama, who seemed intent on upending the traditional power dynamics of the Middle East with his 2015 nuclear agreement with their archrivals, the Iranians.

Subcontracting US policy to the Saudis

The Trump administration subsequently subordinated much of its Middle East policy to the Saudis. When the Saudis blockaded their gas-rich neighbor Qatar in June 2017 shortly after Trump had visited Saudi Arabia, Trump went along for the ride despite that fact that Qatar housed the key US military base that was coordinating the war against both ISIS and the Taliban.

President Trump immediately aligned himself with Saudi talking points about Qatar, tweeting , "So good to see the Saudi Arabia visit with the King and 50 countries already paying off. They said they would take a hard line on funding... extremism, and all reference was pointing to Qatar. Perhaps this will be the beginning of the end to the horror of terrorism!" Was Trump simply unaware of Qatar's importance to the United States?

Then came Iran: The International Atomic Energy Agency repeatedly certified that Iran was sticking to its agreement with the United States and wasn't developing nuclear weapons.

Yet on May 8, 2018, Trump announced that he was pulling out of the Iran nuclear agreement, saying, "The fact is this was a horrible one-sided deal that should never, ever have been made."

The Saudis were elated at the actions taken against Iran. The Saudi Foreign Ministry announced that it welcomed the Trump administration pulling out of the deal and the reimposition of draconian sanctions on Iran.

Yemen war

In 2015, MBS had launched a ham-handed war against Iran-backed rebels in neighboring Yemen which the UN said has precipitated the worst humanitarian catastrophe in the world.

As a result, last year the US Senate voted to end any American support for the war in Yemen, and the House approved a similar measure. To no one's great surprise, Trump vetoed the resolution on April 16, 2019.

A month later, against considerable congressional opposition, Trump pushed through $3 billion of arm sales to the Saudis citing purported national security concerns.

The killing of Jamal Khashoggi

Finally, consider the murder on October 2, 2018, of Jamal Khashoggi, a prominent Saudi writer, who entered the Saudi consulate in Istanbul to obtain paperwork so he could marry his Turkish fiancée. A contributor to the Washington Post, the 59-year-old Khashoggi was a critic of the Saudi regime who was living in self-imposed exile in the United States.

After Khashoggi's murder, Trump was on the phone regularly with Saudi King Salman and with his son. The conversations between Trump and King Salman and MBS were kept very secret. Typically, there would be several senior officials listening in to a call with an important foreign leader, and then a transcript of the call would be circulated to those officials. To prevent leaks, no transcript was made of Trump's calls with King Salman or with MBS.

In public, Trump was defending the Saudis, but when he spoke to King Salman he was blunt, saying, "This is a huge problem. Where's the body? We've got to resolve this. We've got to get his body back to his family," a Trump administration official told me. Salman always denied any knowledge of the murder plot.

Get our free weekly newsletter Sign up for CNN Opinion's new newsletter. Join us on Twitter and Facebook

According to the official, Trump also spoke to MBS separately, asking him, "Did you know anything about this? Did you have any role? Mohammed, I need to know. Was there a bone saw? Because if there was a bone saw, that changes everything. I mean, I've been in some pretty tough negotiations. I've never had to take a bone saw with me." These conversations are reported for the first time here.

MBS told the President, "I don't know. We're trying to find out. Where the body is, we don't know. We know it was given to a Syrian."

Trump asked the Crown Prince quizzically, "Just a random Syrian walking around in Turkey?"

MBS replied, "Well, we don't know. We're trying to find out. It was given to a Syrian living in Turkey, and we don't know where he took the body."

Trump said, "Okay. Well, keep us updated. We got to know. We got to know."

Trump added, "You know, we're sticking by you. This is an important relationship," the official said.

And that in a nutshell is Trump's response to anything involving the Saudis -- "We're sticking by you" -- even when that involves a Saudi military officer allegedly killing three American sailors on Friday.