On Tuesday, President Trump warmly welcomed Turkish President Recep Tayyip Erdogan to the White House.

Just hours later, we found out that Trump would like to put reporters in jail.

There’s a connection here. And it’s not good news for America’s journalists or the citizens who depend on them to hold their government accountable.

Both as a candidate and as president, Trump has shown no regard for the role of a free press in a democracy.

New York Times Executive Editor Dean Baquet told me he found appalling Trump’s suggestion (which surfaced in a leaked memo from former FBI director James B. Comey), but not entirely surprising.

(Erin Patrick O'Connor/The Washington Post)

“He doesn’t understand our role. He wants ‘Fox & Friends’ coverage instead,” Baquet said.

So Trump’s embrace of Erdogan — who may be the leading jailer of journalists in the world — should come as no surprise. The same goes for his regard for the leadership of Russian President Vladi­mir Putin or Egyptian President Abdel Fattah al-Sissi, clear enemies of a free press in their countries.

The lack of criticism from the Trump administration about Turkey’s human rights and journalistic abuses “sends a bad signal to the rest of the world,” said Washington Post Executive Editor Martin Baron.

“What’s happening in Turkey is just outrageous,” Baron said. “They hardly have an independent press. There are hundreds of journalists in jail at this moment.”

The news about Trump’s wish to jail journalists came in a New York Times report based on conversations with former associates of the fired FBI director. It’s exactly the kind of story Trump would like to stamp out, along with Monday’s Washington Post piece that Trump revealed highly classified information to the Russian foreign minister and ambassador. (The two papers have been answering each other’s major scoops like smitten teens volleying text messages.)

Those who think that reporters can’t be jailed in America for doing their jobs may be wrong, said Geoffrey R. Stone, the University of Chicago law professor who wrote “Perilous Times: Free Speech in Wartime.”

The law seems clear enough on leakers themselves; in many cases, especially during the Obama administration, they have been successfully prosecuted. (Chelsea Manning’s 35-year prison sentence testified to that; the former Army intelligence analyst was released Wednesday after seven years because President Barack Obama commuted her sentence.)

And, on the other end of the spectrum, Stone said, news organizations that publish leaked information seem to be safe. The Pentagon Papers case, which torpedoed prior restraint, “remains a pretty strong precedent.”

But, in between leakers and publications are the reporters themselves. There, the legal lines are far less clearly drawn.

“The law is not clearly resolved for the journalist who actively encourages the leak,” Stone told me. “That’s a case the court has not addressed.” And that’s just where Trump seems to want to go.

Baquet made the case for exactly the kind of journalism the president wants to punish.

“The biggest and most important stories of recent years” wouldn’t have been done without classified leaks, he said. One example is the expansion of America’s drone warfare in Yemen and Pakistan; another is the U.S. government’s widespread surveillance of its own citizens.

“These are not even debatable as things the American people need to know,” Baquet said.

Imprisoning journalists is not unheard of in America. New York Times reporter Judith Miller was jailed in 2005 for refusing to reveal a confidential source. And the Times’ James Risen was threatened with jail during the Obama administration for his refusal to testify about a government employee who was under investigation.

But what Trump talked about would take things to a whole new level. His administration apparently wants to use the Espionage Act not just to go after leakers but to directly prosecute journalists. The 1917 law, once obscure, is so broadly worded that it might well serve the purpose.

Trump’s attorney general, Jeff Sessions, refused to pledge during his Senate confirmation hearing that he wouldn’t pursue journalists for doing their job. And the Justice Department has made it clear that it wants to go after Julian Assange of WikiLeaks — a successful prosecution there might make the next ones much easier.

That, said Baron, could shut down a fair amount of accountability journalism: “It would take the government into very new territory.”

Would the current Justice Department really follow through on Trump’s expressed desire?

Hardly out of the question.

“Hopefully, it’s typical gibberish,” Stone said of Trump’s comments to Comey. “But it’s so unpredictable. Would they really bring that prosecution? I can imagine these characters doing that.”

We need journalism to break through government secrecy and inform citizens. Punishing reporters has no place in a country that calls itself a democracy.

But as far too many Turkish journalists could tell you, it can be done.

For more by Margaret Sullivan visit wapo.st/sullivan