The assassins who ambushed Jamal Khashoggi in Istanbul on Oct. 2 must have figured they were protected. Not only is the consulate where Khashoggi was lured to his death technically Saudi Arabian property under diplomatic law, but the killers were operating on Turkish soil -- some of the most dangerous terrain for a journalist on Earth.

Khashoggi was a contributing columnist for The Washington Post and editor-in-chief of Al-Arab News Channel. Publicly critical of the atrocious human rights record of Saudi Crown Prince Mohammed bin Salman, he was targeted by the prince’s henchmen – a killing exposed by Turkey’s president, Recep Tayyip Erdogan.

“Whitewashing such barbarity,” Erdogan explained while ratting out the Saudis, “will of course injure and wound the conscience of all humanity.”

Most Americans (with one prominent exception) would agree with that sentiment. But coming from Erdogan, it was an expression of almost pure cynicism. Under his rule, the Turkish government has seized more newspapers, taken over more television stations, and imprisoned more journalists than any regime in the world.

In its annual report on press freedom, Reporters Without Borders ranks Turkey 157th out of 180 nations worldwide. Yes, this NATO country controlled for the past decade by an Islamicist trails Russia and barely edges out Iraq. Erdogan is one of Reporters Without Borders’ notorious “predators” of press freedom -- a rogues’ gallery of tyrants personally committed to ensuring their own people know only propaganda.

Usually Erdogan’s government simply lies about what it’s doing. In a recent BBC interview, an Erdogan stooge named Gulnur Aybet quibbled with a finding by the Committee to Protect Journalists that Turkey was No. 1 in the dubious category of imprisoning journalists. “There are people,” she said, “who have written in that form that their profession is ‘journalist,’ but they are not necessarily journalists.’”

This must strike those arrested solely for what they’ve written as insane. Three weeks after Jamal Khashoggi’s killing, an Istanbul court sentenced three journalists for a now-shuttered pro-Kurdish news outlet to prison for the crime of “insulting the president.”

It’s tempting to quip that if that same transgression were a crime in the United States, we’d need more prisons. I realize the situation in Turkey is no laughing matter -- it’s a threat to the world order -- but Erdogan is so comically insecure he begs to be ridiculed.

Last year, Nevşin Mengü, an anchorwoman with CNN’s Turkish affiliate, was fired after reporting on Erdoğan’s meeting with Donald Trump. Her sin seems to have been informing viewers that the two presidents’ session lasted only 23 minutes. As she told the Atlantic Monthly: “Erdoğan told our Ankara office: ‘I want your boss to take care of this woman,’ so they took me off air.”

If you think that is thin-skinned, four years ago Turkish cops carted a 16-year-old to jail for saying during a student protest that Erdogan was a thief. If truth were a defense, the boy would have earned an “A.” Turkey’s ruling party has become a kleptocracy. Months earlier, Erdogan was heard on a surreptitious recording instructing his son to hide millions of dollars in incriminating cash from anti-corruption investigators. Erdogan responded with his typical torrent of contradictory bluster, mendacity, and threats. Although he described the recordings as “complete lies,” he conceded that his phone had been tapped, but said the real outrage was the taping itself, which he termed “Turkey's biggest eavesdropping scandal of all time.”

Two weeks ago, the top five editors and columnists from the opposition party daily Sözcü were indicted for "willingly and knowingly” aiding a terrorist organization. The organization referred to is the wreckage of a political party once ruled by Fethullah Gulen, a 77-year-old imam in self-exile in Pennsylvania. Gulen is a convenient bogeyman for Erdogan, but what made the arrests of the Sözcü journalists so pernicious is that they detest Gulen. Erdogan is so paranoid that in Turkey, the enemy of my enemy is…my enemy.

Any journalism school student could see through this ruse, although it takes moxie to speak out. Once such student, Berivan Bila, was detained three weeks ago for writing: “Journalism School Lesson No. 1: Journalism is not a Crime.” She, too, was charged under the ubiquitous pretext of “insulting the president.”

After a recent trip to New York for a U.N. meeting, Erdogan kicked off the opening of the Turkish school year with a speech saying that other world leaders also fear the media in their countries, adding that he considers democracy and a free press incompatible. “Democracy is empowered by the people,” he said. “It is not possible for a politician to pursue sound politics if he or she is afraid of the media.”

But Erdogan hasn’t only persecuted the media -- or Turks. Earlier this year, Turkish secret police operating in Kosovo kidnapped six Turkish nationals, and took them to prison in Turkey. The men were not journalists, but teachers at a pro-Gulen school. Meanwhile, his police have regularly been arresting German-born journalists of Turkish ancestry – German citizens.

On Sept. 11, the regime escalated things by arresting Max Zirngast, an Austrian student and journalist who is not Turkish at all. Born in the Alps region of Steiermark to Austrian parents, Zirngast developed an affection for Turkish culture from college friends in Vienna. He learned the language, became a committed socialist, began writing about politics (millennials!), and moved to Turkey. His writings came to the attention of the regime, with predictable results. He’s being held, without formal charges, in a filthy Turkish prison.

Recently, Zirngast authored a Washington Post op-ed. He sounds like a brave and eloquent young man. I’m no socialist, but I’d be proud to know him. I can’t say the same for President Erdogan. The larger question is whether, under his rule, Turkey is still a Western ally. His mad musings about democracy and freedom of the press weren’t throwaway lines. A momentous question of the 21st century is whether Islam and democracy are compatible. I believe they are -- but not without an unfettered and courageous media in Islamic countries. Erdogan’s drivel is not merely idiotic; it’s dangerous. Freedom of the press is what makes democracy possible. I suspect this guy knows it, too. He doesn’t believe in democracy. Or freedom. Which means that at some point, the United States and its allies must ask themselves a difficult question: Does the existence of NATO airbases on Turkish soil – bases used in the U.S. war on terror -- give Erdogan carte blanche?

Here’s the rub, though: President Trump’s rhetoric about the press is often indistinguishable from President Erdogan’s. Shouting “fake news” at a campaign rally? We can take that. But an incumbent U.S. president who calls the media the “enemy of the people” is something else. So were the chants at Trump rallies, whenever Hillary Clinton’s name arose, of “Lock her up!” Similar chants erupted as former National Security Adviser Michael Flynn headed to court last week.

Donald Trump isn’t the only American politician who speaks in ugly ways about the media or political opponents. Alexandria Ocasio-Cortez, the 29-year-old New York barista who won election to Congress this year as Democratic-Socialist, didn’t like a recent Politico story about her. So she attacked the press on Twitter, saying that newspapers were mainly good for birdcage lining. It’s no accident that Donald Trump Jr. expressed solidarity. Meanwhile, California Rep. Devin Nunes, who should know better, has started a full-blown feud with his hometown paper, the Fresno Bee.

Is this all Trump’s fault? Obviously not. The mainstream media have been hostile. The Obama Justice Department prosecuted more journalists for leaks than all previous presidents combined. This doesn’t count Judith Miller -- jailed for contempt of court by a compliant judge egged on by a vindictive special prosecutor.

The lesson here is that when Trump says, “We don’t have a country without a border,” there’s a better way of thinking about immigration – and democracy. A country without freedom of the press is not a country worth defending.

Correction: An earlier version of this article mistakenly stated that Turkey is a member of the European Union.