One of the biggest surprises of Donald Trump’s presidency has been the hidebound conservatism of the former Democrat and occasional liberal, who changed his party affiliation six times and whose far-right credentials came under constant fire during the 2016 primaries. Even today, amid the covid-19 pandemic, there remains hope he might strike a game-changing infrastructure deal with Democrats or otherwise defy party dogma in the stimulus measures being considered.

But these expectations were and are castles in the air, given the way Trump is following word for word the playbook of Sen. Joe McCarthy. While America remembers McCarthy as its iciest of cold warriors, he wasn’t always such. In fact the Wisconsinite was one of history’s most shameless political converts, flip-flopping not just from Democrat to Republican, but from flaming New Dealer to icon of the Republican right. Among the lessons Trump has taken from McCarthy, one is most resonant: to be believed, converts must become fanatics. In this regard, the president has outdone the notorious senator in the way he panders to his Republican base with baldfaced lies and bare-knuckled assaults, even in a moment of national crisis.

In his first campaign, in 1936 for district attorney of Shawano County, McCarthy declared himself a Democrat and a “militant” backer of President Franklin D. Roosevelt’s liberal policies. To prove it, he seized control of the local Young Democrats, served as Roosevelt’s fundraiser-in-chief in that slice of rural Wisconsin and vilified Republican presidential nominee Alf Landon, calling his platform “brainless, half-baked, cockeyed pleas.” McCarthy voted for Roosevelt three times and told voters they’d be crazy not to stick with the president, “every drop of whose blood and every faculty of whose mind and body is devoted to that great noble, unselfish task … of serving all the American people.”

But on Election Day, even as Roosevelt was obliterating Landon in Wisconsin, the incumbent district attorney trounced McCarthy by a nearly two-to-one margin. The race taught the young office seeker three essential lessons. First, withering attacks worked to put your opponent on the ropes. Second, newspapers would print most anything a candidate said, which in McCarthy’s case included a page-one puff-up of his own resume. Most tellingly, McCarthy saw he couldn’t win as a Democrat in that GOP swath of the Badger State, but he couldn’t appear too opportunistic in abandoning the party of his father and most of the rest of Irish America. So he quietly pulled back from his Democratic activism, expediently sat out the next election and determinedly scouted out a political office free from partisanship.

It didn’t take him long to find the perfect office. Circuit judges were elected on a nonpartisan basis, which meant less focus on McCarthy’s Democratic roots when he won convincingly in 1939. Thanks to the way Wisconsin registers voters, McCarthy was able to keep his partisan affiliation a secret, worrying he’d look like a turncoat to Democrats and an arriviste to Republicans.

Seven years later, however, he was running and winning again, this time for the U.S. Senate — as a self-styled stalwart, which is what conservative Republicans in Wisconsin called themselves. Stalwart leader Thomas Coleman began the campaign deriding McCarthy as a “Johnny-come-lately in Republican politics,” but ended up, along with everyone else, in awe of the artful shape-shifting that saw McCarthy rise from chicken farmer to small-town jurist to U.S. senator at the comparatively youthful age of 39.

Yet, McCarthy’s most audacious opportunism had less to do with his abrupt partisan transformation than with the cause that made his name into an ism. En route to a Lincoln Day Dinner in the Democratic stronghold of Wheeling, W.Va., it came to the senator like a bolt of lightning: Anticommunism was just the issue to go after his old Socialist-coddling confederates, grab the media spotlight and prove himself to his new conservative allies.

His timing was pitch perfect. Americans were in a tizzy that winter of 1950. Six months earlier, U.S. spy planes had confirmed Russia, too, had an atomic bomb. The morning of McCarthy’s Wheeling speech, the Chicago Daily Tribune laid out the threat from the godless, ruthless Soviet empire and, creepier still, from pinkos lurking behind every pillar in our own out-of-touch State Department. McCarthy recognized that with things so scary school kids would learn to duck and cover to escape a nuclear blast, there had to be somebody to blame. Joe McCarthy arguably was less versed in foreign policy than anyone in the Senate in 1950. But nobody was better at reading America’s pent-up fears and feeding them.

“I have here in my hand a list of 205 … a list of names that were made known to the secretary of state as being members of the Communist Party and who nevertheless are still working and shaping policy in the State Department,” McCarthy declared. It wasn’t the first occasion where this senator had whipped up the specter of an enemy within, nor was he the first to try.

But this time he grasped something earlier treason-shouters hadn’t: Counting and naming the actual traitors had a frontier justice allure. No matter that the paper he was clutching didn’t justify his numbers or fill in his list. Nor that he’d waited until the last minute to decide which speech in his briefcase to deliver, the Red-baiting barnburner or a snoozer on national housing policy. His Wheeling tirade may have had Abe Lincoln turning somersaults in his tomb, but to Joe McCarthy it was a return to first principles: “If you want to get anywhere in politics, you’ve got to feed the public what they want to hear and not what you believe,” he confessed to Grover Meisner, a loyal Democrat who had campaigned alongside him in 1936.

When fellow lawmakers denounced his anti-communist crusade as a hoax and him as a charlatan, he brazenly doubled down on the broadsides, in the process snatching the limelight he craved. His tally of Communists in the State Department would change repeatedly depending on whom he was addressing and whether he was under oath.

McCarthy all but confessed he had been winging it when he met with a trio of journalists from the Milwaukee Journal two weekends after Wheeling. “The three of us used everything but the third degree in trying to get some hard evidence,” recalled editorial writer Paul Ringler. Pounding the table, McCarthy shot back, “Listen, you ba-----s. I’m not going to tell you anything. I just want you to know I’ve got a pailful of s--- and I’m going to use it where it does me the most good.”

What mattered in the end wasn’t whether reporters and editors swallowed McCarthy’s names and numbers, but that enough ordinary Americans believed he had the list he claimed of Reds in Foggy Bottom. Then as always, he wasn’t sure of the formula he’d follow — demagogues seldom are — but he could sense in his bones how to keep the pot simmering and knew when he’d achieved a critical mass. Suddenly and shockingly his scattershot bile was gaining traction and lacerating countless noncombatants.

Nobody was more dazzled by McCarthy’s Machiavellian blueprint than his protege, attorney Roy Cohn, who decades later passed the hardball lessons on to his own protege, the young Donald Trump. Like McCarthy, Trump has proved himself a genius at feigning evidence to support his assertions, whether it was claiming the covid-19 crisis would blow over in a few days, or touting a purported miracle drug to fight it. Attacked, bullies like McCarthy and Trump aim a wrecking ball at their assailants. When one charge against a manufactured enemy is exposed as hollow, they lob a fresh bombshell. If the news is bad, they call the reporters liars. Through endless, mind-numbing repetition, Trump’s fictions, like McCarthy’s, become facts.

In 1954, polling pioneer George Gallup penned a prediction about Joe McCarthy’s minions: “Even if it were known that McCarthy had killed five innocent children, they would probably still go along with him.” Sixty-two years later, candidate Donald Trump issued a chillingly similar boast about the durability of his support that sadly forecast his disinclination to compromise: “I could stand in the middle of Fifth Avenue and shoot somebody, and I wouldn’t lose any voters.” While America has yet to render its final verdict on the president’s demagoguery, it left little doubt how it felt about the senator’s. Just six months after Gallup’s prophecy — when McCarthy went a step too far by attacking the U.S. Army — the Senate issued a historic rebuke that all but ended the Wisconsin Republican’s career and his movement.