President Donald Trump today provided the perfect lesson in how not to respond to tragedy.

Eight people were killed and nearly a dozen more injured yesterday when a man drove into the bike lane of a street in Lower Manhattan. Instead of expressing unity and resilience, Trump took to Twitter to further his nativist agenda, calling for entire Muslim and immigrant communities to be punished and for some of the worst national security policies of recent years to be revived. Specifically, Trump called for new “extreme vetting” procedures to keep Muslims out of the country, for an end to diversity-based immigration programs, and for the accused perpetrator of yesterday’s attack to be sent to Guantánamo.

We’ve gone down this irrational, knee-jerk path before — it never made us safer. In fact, some of our worst, most shameful moments in history occurred when we let fear get the better of us.

The “extreme vetting” that Trump wants to see more of refers to a host of policies intended to make it harder for certain people to immigrate to this country. Who those people are is no secret: Trump made that clear on his campaign trail when he called for a “total and complete shutdown on Muslims entering the United States until our country's representatives can figure out what is going on.” He later admitted that because an explicit Muslim ban could offend sensitivities or the Constitution, the ban had “morphed” into nationality-based proposals and “extreme vetting.”

Indeed, the Trump administration has sought to leverage the failure of his consecutive Muslim bans to target Muslim immigrants in other ways. Already, we know that the visa application process has become more stringent for citizens of certain countries and the number of visas issues to individuals from Muslim-majority countries has dropped significantly, particularly those listed in iterations of the Muslim ban. (Though given the lack of transparency from the government, we don’t yet have a clear picture of how the administration’s approach has played out around the world.) We also know that social media surveillance of Muslim and other immigrants has stepped up. In addition to slashing the number of refugees the U.S. has agreed to receive, the government has also made the refugee admission process more restrictive and, most recently, placed a 90-day ban on refugees from almost entirely Muslim-majority countries, placing additional burdens on the most vulnerable people in the world.

Make no mistake — these policies use a national security pretext to bring the Trump administration closer to its goal of ending Muslim immigration to this country. An end to the visa diversity program, which would disproportionately affect Muslim and African communities, has exactly the same goal.

As for Trump’s call for Sayfullo Saipov, the accused attacker in New York, to be sent to Guantánamo — few symbols better illustrate the government’s worst impulses than the prison at Guantánamo Bay. Used to imprison Haitian refugees in the 1990s, and then fashioned after 9/11 as an “island outside the law” where prisoners could be tortured with impunity, Guantánamo now houses 41 men, most held without charge or trial. It is also home to a fundamentally broken military commissions system. Guantánamo was shown long ago to be an epic failure. The FBI and our federal court system are more than capable of dealing with terrorism cases.

Trump might take a cue from New York’s local leaders. Both Mayor Bill De Blasio and Gov. Andrew Cuomo have provided an example for how to lead without compromising our values and the rule of law. The president could also learn something from the New Yorkers who celebrated Halloween last night as planned in a demonstration of resilience, or from those who will show up to tonight’s interfaith vigil as an affirmation of the city’s values. Turning against each other or abandoning our principles throws away our greatest strengths and does nothing to make us safer. Excising entire groups from our immigrant communities, turning back the clock to return to an immigration system that explicitly and irrationally discriminates, and abandoning our Constitution does not make us safer.

History teaches that these fear-based attacks on immigrants inevitably bleed over into attacks on all our civil liberties—as U.S. citizens of Japanese ancestry can painfully attest. Such calls focus resources on fruitless measures and seek to exploit tragedy for a fundamentally racist agenda.

We must push past attempts to use fear to divide us. We must demand actions that focus on evidence-based preventive measures and individualized suspicion, rather than efforts to punish Muslims and immigrants as a whole.

Trump counts on violence like yesterday’s attack to distract Americans from our commitment to due process, the rule of law, and basic fairness. We can’t let him. It’s on us to make sure that we uphold the laws and values of our country. Destroying them doesn’t make us safer.