Donald Trump, not a sentimental man, is quick to throw overboard any crony he feels hurts his interests. Just since becoming president, Trump has cut ties with his personal lawyer Michael Cohen (now serving a prison sentence for campaign finance violations committed in Trump’s service), longtime political adviser Roger Stone (awaiting trial as a result of the Robert Mueller investigation), and once close friend Tom Barrack (under a cloud for profiting from influence peddling during Trump’s inauguration). Rudy Giuliani, who replaced Cohen as Trump’s consigliere, might be the next to walk the plank.

Giuliani is at the heart of the Ukraine scandal that threatens to unravel Trump’s presidency. It was Giuliani who kept whispering in Trump’s ear about the alleged corruption of Joe Biden and his son Hunter, which led to the Trump White House’s push for an investigation of the Bidens by the Ukrainian government. The former New York City mayor has also filled Trump’s all-too-susceptible mind with lurid conspiracy theories about the deep state and its alleged role in entrapping the Trump campaign in Russiagate. These theories are the ideological bedrock of Trump’s fight against the intelligence community. If his presidency goes down in scandal, Giuliani will bear as much of the blame as anyone besides Trump himself.

Trump’s other advisers are quick to point their fingers at Giuliani. As Politico reports, prominent Trump advisers have been trying for weeks to get him to jettison Giuliani. This push was going on even before two of Giuliani’s business associates, both allegedly implicated in Ukrainian shenanigans, were arrested last week for campaign violations.

But Trump seems reluctant to cut ties with Giuliani. On Saturday, Trump and Giuliani had lunch at one of Trump’s golf courses—a very visible show of solidarity that dampened questions raised by Trump’s earlier comments that he wasn’t sure Giuliani was still his lawyer.

If Giuliani is the trigger of Trump’s political destruction, it’ll be an ironic turn of events, because Giuliani was crucial to creating Trump. Some former Giuliani admirers have painted his alliance with Trump as disappointing falling off. According to biographer Andrew Kirtzman, Giuliani was “iconoclastic and fearless” during his first term as mayor in developing innovative crime-fighting policies, but “Giuliani is not really the Giuliani we have seen for a long time.” Giuliani has become a kind of fallen hero to many moderate Republicans, who yearn for the days when he could be seen as the leading GOP avatar of mainstream social views. (He is pro-choice and supports gay rights.)

But this is a far too rosy view of Giuliani’s career. In truth, there is a strong continuity between the mayor of the 1990s and the Trump co-conspirator of 2019. Writing in The Nation, investigative reporter Tom Robbins notes that despite Giuliani’s being renowned for work pursuing criminals and Trump’s being equally famous for skirting rules, the two men have much in common. “Both reveled in public brazenness. Giuliani walked stockbrokers off the trading floor in handcuffs. Trump ripped down precious landmarks to make way for his buildings. Both were also fluent in the language spoken among the elite of New York deal-makers, where favors are traded, punches are pulled, and the public interest always finishes a dismal last,” Robbins writes.

But there’s a deeper ideological affinity beyond their similar personalities. Giuliani faced the same political problems in the 1990s that Trump did during his presidential run in 2016: Giuliani was a very abrasive, very New York politician who was known as a bit of a libertine (he would marry three times and enjoy a personal life that kept gossip columnists busy) but had national ambitions in a political party that was very evangelical, with its cultural base in the South. Despite these liabilities, Giuliani made himself a celebrated figure in the Republican Party even before his calmness during 9/11 transformed him into a cultural icon.

Though Giuliani fizzled in his 2008 bid to become the Republican presidential nominee, he cleared a path for Trump. Giuliani proved that you could have a lurid, tabloidy personal life and still be loved by millions of Republicans. And he managed this feat in the same manner that Trump would: through culture-war politics and racism.

What Giuliani demonstrated was that Republicans were quick to forgive personal flaws and a nasty temper in a politician as long as they believed he was fighting their enemies. Meanness, in fact, was a virtue if the politician was going after smutty artists or African American politicians. Hence Giuliani’s hyperbolic attacks on his foes, such as the Brooklyn Museum, which had the temerity to feature art he dubbed anti-Catholic. “I’m not going to have any compunction about putting them out of business,” he said about the museum.

Feuding with New York City Schools Chancellor Rudy Crew, Giuliani in 1991 said, “The whole school system should be blown up.” Working to undermine Crew, Giuliani leaked information about the chancellor’s faltering marriage. As Crew told journalist Jack Newfield, “When Rudy sees a need to take someone out, he has a machine, a room full of henchmen, nicking away at you, leaking crazy stories. He is not bound by the truth. I have studied animal life, and their predator/prey relations are more graceful than his.” These are the traits that allowed Giuliani to bond with Trump.

This dog-eat-dog attitude is tied to Giuliani’s racial politics. Just as Trump succeeded Barack Obama, Giuliani came after New York’s first African American mayor, David Dinkins. No less than Trump, Giuliani rose to power by stoking white resentment of rising black political power. Giuliani became notorious for his scorn of black politicians and his defense of the police even in cases of unbridled racist brutality, such as the shootings of Amadou Diallo in 1999 and Patrick Dorismond in 2000.

Beyond his notorious refusal to rein in the police, Giuliani governed New York as if he cared only for his white constituents. In a 1992 interview with Jack Newfield, Giuliani gave vent to racist conspiracy theories to explain his loss to Dinkins in the 1989 election. “They stole that election from me,” Giuliani claimed. “They stole votes in the black parts of Brooklyn, and in Washington Heights. Illegal Dominican immigrants were allowed to vote in Washington Heights.” Again, Giuliani was anticipating the language of Trump, who would claim, without evidence, that Hillary Clinton’s win of the popular vote in 2016 was due to votes casts by undocumented immigrants.

Giuliani pioneered a new style of Republican politics during his term as New York mayor from 1994 to 2001, showing the mileage you could get from being an in-your-face New York loudmouth harping on culture-war hot button topics and fomenting racial resentment. This is the true source of the affinity Giuliani has for Trump. The paranoid anger that fueled this new politics may now also be the source of Trump’s undoing.