Terence Szuplat served as a foreign policy speechwriter and as a deputy director of White House speechwriting under President Barack Obama. He is the founder of Global Voices, a communications firm.

The terrorists behind the attack, he said, need to be “rubbed out.” “Law and order” must be preserved. The courts are “against the country” and “the media should not have unlimited freedom.” “I will allow the military to try you,” the president warned terrorists, “and put you to death.”

You could be forgiven for thinking these were the words of President Trump reacting to Tuesday’s terrorist attack in New York City that killed eight and wounded 12. It’s all there: The familiar Trump bravado. The call for swift justice. The indictment of other institutions — the courts, the press — that are said to be too weak or unwilling to help safeguard the nation.

But each of the quotes above are from authoritarians who have exploited terrorist attacks to undermine rule of law in their own countries and for whom Trump has breathlessly professed admiration. And this week, he has also sought to emulate them.

It was Vladimir Putin, who as Russian prime minister in 1999, said terrorists who bombed apartment buildings in Moscow, killing hundreds, needed to be “rubbed out” — fueling Russia’s brutal second war on Chechnya and Putin’s rise to the presidency. As for Putin’s suffocation of Russian democracy since, and the killing of journalists, Trump once replied, “at least he’s a leader.”

It was President Abdel Fatah al-Sissi — the military dictator of Egypt — who signed a law this year banning nongovernmental organizations from work that undermines “law and order,” part of a crackdown that has jailed tens of thousands of political opponents and led to widespread torture and extrajudicial killings. “He’s a fantastic guy,” Trump said after welcoming Sissi to the Oval Office. “He’s done a good job.”

It was Turkey’s president, Recep Tayyip Erdoğan, who railed against judges and journalists during his ongoing assault on the courts, civil service, media and civil society. He’s earning “very high marks,” said Trump.

And it was Philippine President Rodrigo Duterte who threatened Islamist militants with military trial and death, has waged a war on drugs that has left thousands of Filipinos dead and likened himself to Hitler. Trump has praised him for “fighting very hard” for his country and will soon meet with him.

For the first 10 months of his presidency, the implications of Trump’s unapologetic embrace of autocrats and his own authoritarian tendencies were, for the most part, a matter of conjecture — fear of what he might say and do in a crisis. Earlier this year, I warned that a terrorist attack under Trump would be “a demagogue’s dream and a uniquely dangerous moment for our democracy.”

With this week’s atrocity in New York — the deadliest attack in the city since 9/11 — that moment is here. As if on cue, Trump has broken out the authoritarian’s playbook and delivered his own shameful performance, chapter and verse.

He could, it seemed, barely wait to get started. Police say the attacker in New York, Sayfullo Saipov, drove his rental truck onto a bike path in Lower Manhattan and started mowing down cyclists and pedestrians at 3:04 Tuesday afternoon. Trump was tweeting within 90 minutes (“NOT IN THE U.S.A.!”) and condemning the Islamic State (“Enough!”). Eventually, in his third tweet, he remembered to extend condolences to the victims. Before the night was over, he called for more “extreme vetting” of immigrants, even though initial reports say Saipov was radicalized after he immigrated to the United States from Uzbekistan in 2010.

Like any good demagogue, Trump moved quickly to find a villain: Democrats, including Senate Minority Leader Charles E. Schumer (N.Y.), who nearly 30 years ago supported the creation of the diversity visa lottery program under which Saipov entered the United States. In his tweets and remarks, Trump seemed to go out of his way to say it repeatedly — “diversity program,” “diversity visa” — clearly eager to tee up a false choice between diversity and security. “No more Democratic Lottery Systems,” he tweeted, misrepresenting a program that was passed with bipartisan support and signed into law by President George H.W. Bush, a Republican.

Most alarming, Trump resorted to the oldest trick in the demagogue’s book — dehumanizing the enemy. The perpetrator is not simply a terrorist, he is, Trump said, an “animal.” While few Americans will disagree about the accused attacker, specifically, such language is particularly ominous given Trump’s habit of conflating terrorists with the broader Muslim American community. Sure enough, when asked by a reporter whether the suspect’s family could also be a threat, Trump, without missing a beat, said “they certainly could.” And so-called chain migration should end, he tweeted, because some immigrant family members “can be truly evil.”

Words matter. And when it comes to the president, words can calm or inflame an already anxious public. Anti-Muslim hate crimes surged in the days following 9/11, but the rate dropped after President George W. Bush went to the Islamic Center of Washington and called for tolerance, according to Brian Levin of the Center for the Study of Hate and Extremism at California State University in San Bernardino, Calif.

Conversely, in 2015 — the year of Islamic State-inspired attacks in Chattanooga, Tenn., and San Bernardino and Trump’s call for a “total and complete shutdown of Muslims entering the United States” — anti-Muslim hate crimes surged. After Trump called for the ban, anti-Muslim hate crimes spiked nearly 90 percent, according to Levin’s research.

If Trump continues to suggest that the suspected attacker’s family could be a threat — as he has done with the broader Muslim American community, which he has accused of having “great hatred” for the United States — harassment and assaults of patriotic, law-abiding Muslims will surely increase. If a mosque is attacked, as one was in Minnesota this summer, the president will surely be slow to condemn it, if he does at all. If armed protesters once again show up at mosques threatening peaceful worshipers, he will no doubt — as he did when white supremacists and neo-Nazis rallied in Charlottesville — blame “both sides.” In the weeks and months to come, responsibility for any anti-Muslim violence will rest in no small measure with the agitator in the Oval Office who aids and abets it.

This moment grows even more perilous because Trump seems to have every incentive to capitalize on the New York attack — and any others that follow — and few incentives to show restraint. Polls show his approval ratings dropping to new lows. With his domestic agenda largely stalled on Capitol Hill and Trump feuding with Republican leaders in Congress, a focus on terrorism may be the only issue around which his party can unite. Special counsel Robert S. Mueller III is accelerating his investigation into whether the Trump campaign colluded with Russia, and the president will likely take any opportunity he can to shift attention away from Russia and onto terrorism.

Just as it propelled his rise to the Republican nomination and the presidency, a hard-line nationalist stance against terrorism, Muslims and immigrants — to Trump and so many of his supporters, they are one and the same — may be one of his few paths to a second term. “Democrats,” he’ll no doubt try to claim again, as he did Thursday, “don’t want to do what’s right for the country.”

On Tuesday, a single, twisted individual got behind the wheel of a truck and mercilessly killed eight innocent people. Yet groups like the Islamic State and al-Qaeda seek to do more than kill. With each attack, they hope to provoke divisions in our society and undermine confidence in the institutions and diversity that define our Republic.

This week, we saw that they have an enabler at the highest level — an unpopular, impulsive, ineffective and increasingly isolated president who in attempting to project a strongman image reveals his fundamental weakness as a leader. Trump has once again succumbed to his worst impulses. The question for the rest of us is, which is stronger — the demagogue or our democracy?

Read more:

Here’s what demagogues like Trump do to their countries

Now we test America’s constitutional democracy

Trump is making us all into conspiracy theorists