We need to get over the old trope that they hate us because we are free.

The Saudi student who fatally shot three people at a U.S. naval base in Florida hosted a dinner party earlier in the week where he and three others watched videos of mass shootings. (screengrab ABC7/Chicago)

The U.S. military is training Saudi Arabian pilots here in States, who later leave to slaughter Yemeni civilians thousands of miles away. Unfortunately, some of that violence was turned against us, when a Saudi trainee killed three American sailors at Pensacola Air Station on December 6.

In fact, a half dozen Saudis were arrested in the incident. Three of them apparently filmed the murders, presumably to post online. Yet afterward President Donald Trump spent more time justifying the Saudi royals than supporting the victims’ families.

Every time a terrorist commits murder and mayhem, Americans ask why? U.S. officials usually insist that it is because we are so “good.” If only.

Why terrorists kill should not be a mystery since they themselves tell us why. And none of them has said it is because the U.S. has the First Amendment, holds democratic elections, or leads the world in charitable giving.

Consider Mohammed Saeed al-Shamrani, the Saudi pilot-in-training at Pensacola. On Twitter he declared: “I’m against evil, and America as a whole has turned into a nation of evil.”

He explained: “I’m not against you for just being American, I don’t hate you because [of] your freedoms, I hate you because every day you [are] supporting, funding and committing crimes not only against Muslims but also humanity.” Al-Shamrani’s complaint is against U.S. foreign policy, which today so often means bombing, invading, and occupying other nations and killing their peoples.

Drones have become America’s newest form of warfare, on the upsurge under Trump. Alas, according to the New York Times: “Every independent investigation of the strikes has found far more civilian casualties than administration officials admit. Gradually, it has become clear that when operators in Nevada fire missiles into remote tribal territories on the other side of the world, they often do not know who they are killing, but are making an imperfect best guess.” Yet the administration has made it even more difficult to judge the impact of the attacks.

Almost a decade ago Faisal Shahzad, a Pakistani-born naturalized American citizen, attempted to set off a car bomb in New York City’s Times Square. Thankfully, he failed to set the timer properly. Then he waited two days to flee the country, giving authorities the time to identify and arrest him.

Ajani Marwat, the intelligence officer with the New York Police Department who investigated Shahzad, explained: “It’s simple. It’s American policies in his country. That’s it. Americans are so closed-minded. They have no idea what’s going on in the rest of the world. And he did know. Every time you turn on al-Jazeera, they show our people being killed.” A terrorist organizer in Pakistan told Marwat: “We don’t have to do anything to attract them. The Americans and the Pakistani government do our work for us. With the drone attacks targeting the innocents who live [here], the sympathies of most of the nation are always with us.”

At his September 2010 sentencing Shahzad declared himself to be “part of the answer to the U.S. terrorizing the Muslim nations. I’m avenging the attacks because the Americans only care about their people, but they don’t care about the people elsewhere in the world when they die.” He vowed that “until the hour the U.S. pulls its forces from Iraq and Afghanistan and stops the drone strikes in Somalia and Yemen and in Pakistan, and stops the occupation of Muslim lands, and stops killing the Muslims, and stops reporting the Muslims to its government, we will be attacking U.S.”

Federal judge Miriam Goldman Cedarbaum made the obvious point that he targeted civilians. Shahzad responded that in a democracy it was civilians who “select the government.” How about children, asked Cedarbaum? Shahzad answered: “Well, the drone hits in Afghanistan and Iraq, they don’t see children, they don’t see anybody. They kill women, children, they kill everybody. It’s a war, and in war, they kill people. They’re killing all Muslims.”

Terrorism has become a tool of many nationalist and separatist groups. Pakistani-backed Muslim Kashmiris who object to rule by Hindu India routinely rely on terrorism. So do Palestinians in territory long occupied by Israel. Russia suffered numerous attacks from Chechens, including by “Black Widows,” whose husbands died in Chechnya’s struggle for independence. Hindu Tamil Liberation Tigers targeted the dominant Buddhist Sinhalese in Sri Lanka, for a time becoming the most prolific suicide bombers on earth, conducting 168 such attacks between 1980 and 2000.

So, too, has America become a target of this horror, though Washington policymakers prefer not to talk about the causes of terrorism.Consider the 1983 bombings of its embassy and Marine Corps barracks in Lebanon. The Reagan administration foolishly intervened in a multi-sided civil war to back the “national” government, which ruled little more than Beirut. After Washington launched air and naval attacks on opposing forces, Lebanese Muslims saw aggression, not liberty, and responded accordingly.

In the 1993 World Trade Center bombing, Ramzi Yousef cited Washington’s use of sanctions to kill Iraqi children as motivation for his actions. He uncannily anticipated then-UN Ambassador Madeleine Albright who, three years later, was asked on 60 Minutes about the sanctions-induced deaths of a half million Iraqi kids. She replied chillingly: “We think the price is worth it.” She never did explain why “we” were authorized to make that choice.

Polls found that large majorities of Arabs and Muslims shared these criticisms of U.S. policy despite expressing admiration for American values and products. University of Chicago’s Robert A. Pape found that terrorists almost always confronted foreign occupation. After studying more than 2,100 suicide attacks, he concluded that “overall, foreign military occupation accounts for 98.5 percent—and the deployment of American combat forces for 92 percent—of all the 1,833 suicide terrorist attacks around the world” between 2004 and 2009. The solution? Said Pape: “By ending the perception that the United States and its allies are occupiers, we can cut the fuse to the suicide terrorism threat.”

The horror of 9/11 made it almost impossible to question the official Bush administration meme that Americans were targeted because they were so good, virtuous, and free. But that simply wasn’t the case. That doesn’t mean the victims “deserved” what they got. Rather, there sometimes are awful consequences to terrible policies. With far greater reason than Washington wanted to admit, the attackers viewed a militarily interventionist America as being at war with them.

In 1996 bin Laden complained that “the people of Islam [have] suffered from aggression, iniquity and injustice imposed on them by the Zionist-Crusaders alliance and their collaborators,” and noted the blood “spilled in Palestine and Iraq” and the killings and interventions elsewhere. On multiple occasions he cited American support for Israel, sanctions against Iraq, and the military presence in Saudi Arabia. In an October 2004 video, he spoke of viewing dead Arab Muslims, after which it occurred to him that “we should punish the oppressor in kind—and that we should destroy the towers in America in order that they taste some of what we tasted, and so that they be deterred from killing our women and children.” Bin Laden was a moral monster, but he had a coherent and logical political objective, one inextricably tied to militaristic U.S. policies.

At least some top Bush administration officials understood the truth. After the Iraq invasion Deputy Secretary of Defense Paul Wolfowitz observed: “We can now remove almost all of our forces from Saudi Arabia. Their presence there over the last 12 years has been a source of enormous difficulty for a friendly government. It’s been a huge recruiting device for al-Qaeda. In fact if you look at bin Laden, one of his principle grievances was the presence of so-called crusader forces on the holy land, Mecca and Medina.”

Tragically, the Iraq war became another extremist recruiting bonanza. Indeed, studies in both Israel and Saudi Arabia found that most of Iraq’s terrorists were new recruits not previously part of the jihadist movement, who were drawn by the war to attack Americans.

The Pensacola murders similarly reflect America’s misguided foreign policy. It is the primary trigger for attacks on Americans.

Washington cannot escape the malign if unintended consequences of its actions. The U.S. regularly meddles in other nations’ affairs. Worse, it routinely invades, bombs, occupies, drones, and sanctions other countries. When outraged foreigners strike back, innocent Americans become targets.

The president should end our endless wars, as he promised. He should also rethink policies that make unnecessary enemies. The motto for statesmanship in this new age should be Hippocratic: first do no harm.

Doug Bandow is a senior fellow at the Cato Institute. He is a former special assistant to President Ronald Reagan and the author of several books, including Foreign Follies: America’s New Global Empire.