When President-elect Donald Trump met last week with news media executives, taking them to the woodshed, so to speak, for what he deemed their faulty coverage of him and his campaign, I felt a shiver of recognition and apprehension.

In 2003, after the U.S. invasion of Iraq, I went to Baghdad as a potential contractor to assess the needs of the Iraqi media. With other contractors hopeful of landing a fat U.S. government contract, I visited radio and television stations and newspaper offices. At the office of one newspaper editor, we were shown into a back room. The editor pointed to a large hook protruding from the ceiling. “That,” he said, “is where Uday [Saddam Hussein’s eldest son] would hang us up by the wrists and lecture us on what we had published.”

At one of the annual gatherings of the Society of Professional Journalists, I listened to a Nigerian newspaper reporter describe how, when he left for work every day, he would carry what he referred to as “the bag.” He said that all Nigerian journalists carried it. The bag contained the essentials for an overnight stay in jail when the journalist was detained for something he had written. Such jailings were so common and predictable that the bag was a normal part of a journalist’s outfit.

There are much worse stories told almost daily around the world. The independent, nonprofit Committee to Protect Journalists, which promotes press freedom globally, lists 1,220 journalists who have been killed in the line of duty since 1992, and 40 killed so far this year. The Committee to Protect Journalists found candidate Trump’s attacks on the press during the campaign so disturbing that the organization issued an unprecedented statement saying that Trump had “betrayed First Amendment values” and that he represented “an unprecedented threat to the rights of journalists.”

A free press is the target of dictators, despots and demagogues all over the world. It is possible to be a journalist in a country without a free press, but it’s a dangerous profession. It is not possible for a country without a free press to be a democracy. That is why press freedom is guaranteed in the U.S. Constitution, and why the press is dubbed the “fourth estate” — its role is to act on behalf of the people as a watchdog over the three “estates” of American government: the executive, legislative and judicial branches. The press in America is far from perfect, but it is essential to American democracy.

A free press has proved crucial to checking wrongdoing in our government. In 1973, Archibald Cox was the special prosecutor investigating the Watergate scandal, which came to light thanks to a free press, a great newspaper — the Washington Post — and some persistent journalists. On Oct. 20 of that year, after Cox had subpoenaed secret White House tapes, President Richard Nixon ordered Attorney General Elliot Richardson to fire Cox. Richardson resigned rather than carry out the order, as did Deputy Attorney General William Ruckelshaus. Nixon appointed Robert Bork, who did fire Cox. The events were dubbed the “ Saturday Night Massacre.”

On the 10th anniversary of Nixon’s subsequent resignation, I interviewed Cox in his office at Harvard University. I said that on that Saturday I remembered feeling that Nixon was out of control and capable of anything, including a declaration of martial law. Did Cox, who was so close to the situation, have any of those same feelings? Cox arched his bushy gray eyebrows. “Oh, yes!” he said. “I feared for the republic!”

Those words come back to me now, prompted by a president-elect’s attacks on one of the essential cornerstones of our democracy. I, too, fear for the republic.

Nick Mills was an award-winning broadcast journalist. He taught journalism at Boston University for 26 years. He is a past president of the Maine Center for Public Interest Reporting.