Joe McCarthy loved to savage reporters, singling them out by name at his rallies in the 1950s. The Republican senator from Wisconsin knew the work of each reporter who covered his years-long campaign aimed at rooting out the communists who were supposedly seeded throughout the federal government. “Stand up, Dick, and show them what a reporter for a communist newspaper looks like,” he’d say, and the crowds would roar their approval as their plain-speaking hero fingered the enemy, the cause of their country’s woes.

Then, moments after leaving the stage, McCarthy would sidle up to a reporter he’d just finished flaying and toss an arm around him: “That was just good fun.”

Reporters who’ve covered Donald Trump anytime in the past four decades know that sense of whiplash all too well. Trump and McCarthy share a populist, demagogic speaking style and a propensity to say anything to win the moment. The two men are often compared because they both aggressively hit back at their critics and tended to inflate minor slights or partisan rows into threats against the nation.

But their similarities go deeper: Both won and cemented support by using, attacking and foiling the news media. Both deployed a crazy quilt of behavior to demand news coverage — and then stomped on those same organizations as disloyal liars conspiring against them.

And both enjoyed extended periods of popularity even amid reporting about their erratic behavior and tendency to say things that weren’t true. In the end, McCarthy fell from grace, but journalism alone wasn’t enough to end his destructive crusade. The news reporting about McCarthy’s excesses did over time diminish his popular support, but ultimately that souring of sentiment had to filter up from the public to their elected representatives. It took years, but McCarthy was finally held to account.

For nearly a decade, a renegade loner who relished being seen as an outsider dominated the news. From 1946 to 1954, McCarthy used threats, factually thin or totally bogus assertions, and personal attacks to capture an almost unprecedented level of attention.

[I wrote ‘The Art of the Deal’ with Trump. His self-sabotage is rooted in his past.]

It was one of America’s periodic dives into deep skepticism and disbelief. Expertise and fact were so widely rejected that the press, which collected and verified facts for a living, proved largely powerless against McCarthy.

The press was the senator’s primary target and tool as he soared to power and prominence, instilling fear of a traitorous faction inside the U.S. government. He kept the fact-checkers and truth-tellers at bay for years by spreading a virus of mistrust of the news. By portraying the press as America’s enemy, he rallied his base and defended himself against increasingly serious allegations of dishonesty and wrongdoing. (It would take more than four years before McCarthy’s party and his supporters reached a consensus that the man who had led their anti-communist crusade was a dangerous demagogue whose allegations bore little connection to reality.)

McCarthy was a model for Trump. The president’s approach to building his personal brand grew out of his close bond with Roy Cohn, McCarthy’s chief counsel during his investigations targeting communists and homosexuals in the government. Two decades later, as Trump’s mentor and lawyer in New York, Cohn taught the young real estate developer the core strategies that would come to define his business and political careers: Use the news media to stay firmly and consistently in the public eye, and when criticized, hit back far harder than you’ve been hit.

McCarthy, like Trump, was better known as a harsh critic of the press than as someone who curried reporters’ favor. “The heads of every one of our intelligence agencies say that, except for communist utilization of the so-called respectable newspapers and radio stations, they could destroy the entire [communist] movement,” he told a Republican club in Wisconsin in 1950.

But like Trump, McCarthy also craved the media’s respect and even acted with surprising solicitude toward reporters. His approach was contradictory: He liked to be around reporters, and he liked to attack them both in private and before audiences. Edwin Bayley, in his 1981 book, “Joe McCarthy and the Press,” concluded that McCarthy “never did understand why his attacks on newspapers . . . should have affected his personal relationships with those whose papers he castigated.”

McCarthy courted, cajoled and carped at journalists. “When you write stuff like that, you’re helping the communists,” he told the United Press reporter who covered the Senate in 1950. McCarthy did not hesitate to get personal, telling Associated Press reporter Marvin Arrowsmith, “I know you’ve got six kids, Marv, and I don’t want to kick about your work, so I hope there is no reason to do so.”

But like Trump, McCarthy could pivot and turn on the charm. When he didn’t like a story by the AP’s John Chadwick, the senator froze him out, refusing to speak to him, making him sit in the rear of the campaign plane and blasting him in a speech in Oklahoma City. Afterward, McCarthy walked up to Chadwick, offered to shake hands and said, “I hope you don’t mind the ribbing.” Then, on the flight back to Washington, he sat next to Chadwick and offered him a drink from the bottle McCarthy kept in his briefcase.

[Trump is mirroring Nixon’s final days]

For decades, Trump has similarly trashed reporters in public, then called them with a juicy story, invited them to dinner or asked them to visit his Palm Beach, Fla., estate. For a time last year, Trump angrily banned The Washington Post from his campaign events. That happened when we were conducting interviews with the candidate for The Post’s biography, “Trump Revealed.” When Trump pulled out of a couple of interview appointments, I called his office, worried that the ban now extended to our reporting for the book.

Trump’s secretary repeatedly asked me, “Is this going to be a good book?,” and I told her that it would be fair and accurate. She wasn’t especially satisfied with that answer, but she relayed the message to Trump, and he immediately agreed to schedule our next interview — which he extended well beyond its allotted hour.

“This is fun,” he said. “Let’s keep going.”

McCarthy delivered his attacks on the press in the hope of undermining their credibility. He called for a boycott of businesses that advertised in the Milwaukee Journal and other publications that were critical of him. The calls fell flat, but McCarthy said that was fine; his purpose was to spread the idea that the papers were biased and untrustworthy. “If you can show a paper as unfriendly and having a reason for being antagonistic, you take the sting out of what it says about you,” he said. “I think I can convince a lot of people that they can’t believe what they read in the Journal.”

Last year, in an interview for The Post’s biography, Trump said that if he didn’t like the book, he’d come after us, just as he had sued the author of a previous book, Tim O’Brien. I asked Trump if he was disappointed that he never got anywhere with that libel suit. No way, he said: His purpose was not to win but to cost O’Brien lots of money, time and aggravation.

As much as McCarthy’s and Trump’s methods broke with traditions, they were effective — even against years of efforts by news organizations to counter their rhetoric with facts.

Some historians have concluded that had news coverage of McCarthy been more aggressive, much earlier, his crusade might have fizzled long before the bulk of the nation came to see him as an absurd, outrageous fraud. But Bayley concludes that the problem was not any lack of truthful, clear reporting: In the major papers in McCarthy’s home state, and later The Post and some other large outlets around the country, “almost every aspect of McCarthy’s record was investigated and his derelictions exposed, over and over. No one cared, though, because it was not McCarthy’s character, morals, or deportment that concerned people; the only issue that mattered was the Communist issue.”

[In Venezuela, we couldn’t stop Chavez. Don’t make the same mistakes we did.]

Editors and publishers spent years debating the complicity of the news media in propping him up. “The press made McCarthy,” the managing editor of the Raleigh News & Observer said in 1953. “We go hog wild whenever he speaks. How much longer are we going to quote irresponsible statements of so-called irresponsible persons?”

That year, at a debate among news executives over how to handle McCarthy, the managing editor of The Post, J.R. Wiggins, said papers were giving too much space to the senator’s baseless charges: “If we circulate . . . day after day, week after week, month after month, the infamous allegation that there’s treason in the White House . . . and in all the other departments of government, we need not be surprised if an hour comes when the American people have confidence in no one.” (The Post’s cartoonist, Herb Block, had already been portraying McCarthy as a bully for a few years by then.)

After many months of frustration about how straight coverage of McCarthy seemed only to bolster his allegations, a consensus developed that news organizations needed to emphasize the meaning and context of the news, not just the basics of what happened. Editors who had resisted the notion of “interpretive reporting” came to agree that readers deserved both facts and analysis that would give them the tools to decide whether McCarthy’s attacks were legitimate.

In 1953, the editor of the Denver Post — which had previously supported McCarthy’s crusade, fretting in editorials that “there are many traitors among us” — instructed his staff to avoid being used by McCarthy. When his charges were clearly false, reporters were told to write that the senator regularly practiced “poor documentation and irresponsible conduct.” Instead of trumpeting each McCarthy allegation on Page One, the editor directed, it should be reported in a less-prominent place with a headline such as “Today’s McCarthyism.” Over time, journalists grew bolder about calling out McCarthy’s slanders.

Of course, that debate echoes today, as journalists struggle to find the right tone and presentation for Trump’s patently untrue statements. Some people have called on the press to minimize coverage of the president. When that argument was made about McCarthy, on the grounds that he was essentially a mischievous adolescent who thrived on the game of battling the press, Post reporter Murray Marder countered that “you had to take him seriously. It was a period of national turmoil. . . . Careers and families were destroyed, people committed suicide. . . . It was the closest we ever came to a real totalitarian atmosphere.”

Did increasingly overt critical coverage of McCarthy turn the tide against him? In some places, yes, and in others, barely at all. In the 1952 election, McCarthy lost much of his support in Wisconsin’s big cities and suburbs, exactly where local newspapers vigorously opposed his unfounded allegations. But in rural and low-income areas, where some papers argued that Democrats were communists and that McCarthy was being unfairly vilified, he gained support, especially where voters were exposed to little reporting on his character and methods.

What McCarthy depended on through those years was what Trump long ago summarized: All coverage is good coverage. Both men mastered the art of trumpeting any positive coverage they got and turning criticism into fodder for the slashing attacks that enhanced their populist appeal.

Newspapers and the new medium of TV eventually helped show Americans the impact of McCarthy’s lies, but no single force, no single blow, brought him down. In 1954, the senator began accusing fellow Republicans in President Dwight Eisenhower’s administration of treason. That led even newspapers that had stood with McCarthy for years to break with him. The New York World-Telegram, long a supporter of the senator, published a five-part series, arguing that he had become “a major liability to anti-Communism.”

Then, former president Harry Truman went on TV and accused McCarthy of using “the big lie and the unfounded accusation against any citizen in the name of Americanism and security.” Truman lamented “the rise to power of the demagogue who lives on untruth; it is the spread of fear and the destruction of faith in every level of our society.”

McCarthy demanded equal time, and the three networks gave him half an hour. He declared that Truman’s administration had been infested with communists and had “sold out the nation to its enemies.” This scorched-earth response proved to be a turning point. At long last, many fellow Republicans realized that there would be no appeasing him, that the senator would do anything to stay in the limelight.

Already, just one-eighth of the way into Trump’s term, many Republicans are saying similar things about him, most only after extracting a promise that they won’t be quoted by name.

And in Trump’s case, the news media has been reporting from the very start about his impulsivity and propensity to engage in what he long ago called “truthful hyperbole.” But as the nation experienced with McCarthy, reporting about a populist’s excesses doesn’t erode his base of support until and unless voters and the leader’s party see that those personality flaws are hurting the nation.

In December 1954, when the Senate finally voted 67 to 22 to censure McCarthy, half the Republicans joined all the Democrats in the vote against their colleague. For years, news outlets had been detailing McCarthy’s falsehoods. His fall to earth may not have been possible without that reporting, but in the end, it was only when the American public could see his snarling abuses for themselves that they realized they’d been had.

marc.fisher@washpost.com

Read more from Outlook and follow our updates on Facebook and Twitter.