“Rudy is great,” Donald Trump gushed last month when announcing the addition of Rudy Giuliani to his legal team dealing with the Russian investigation. “He has been my friend for a long time.”

With friends like that …

On Wednesday night, Giuliani, 73, tied his new boss in knots by blurting out to Fox News that Trump had repaid his private lawyer Michael Cohen $130,000 worth of hush money used to silence the adult-film star Stormy Daniels shortly before the 2016 presidential election.

The comment became an instant social media sensation, emboldening groups already suing Trump over the payment. Quite an achievement for someone barely two weeks into his new job, but wherever he has gone Giuliani has always seemed to spark firestorms.

Barnstorming prosecutor

Giuliani cut his teeth in public office as a US Department of Justice official and then as federal prosecutor in Manhattan. There, ironically, in the late 1980s, he hired the young prosecutor who eventually went on to lead the FBI and then, upon being fired by Trump, become the president’s nemesis – James Comey. He gained public attention and positive reviews for his tough stance on the mafia and Wall Street figures like Ivan “greed is good” Boesky.

But even then, seeds of later controversies could be seen to be sprouting. He was accused of being more interested in his own publicity than justice. After he stepped down as US attorney, he made an inflammatory appearance at a police union rally against the then mayor David Dinkins that turned rowdy.

America’s mayor

Giuliani’s finest hour was his response to the New York terrorist attacks on 9/11. Sporting a baseball cap bearing the badge of the New York fire department, he placed himself amid the dust of Ground Zero and became the figurehead for tolerance, calm and resilience in the devastated city, earning himself the title “America’s mayor”.

Giuliani with George W Bush and New York’s governor, George Pataki, in the aftermath of 9/11. Photograph: Doug Mills/AP

There were other sides to his eight years as New York mayor that have tended to be buried under the 9/11 praise. His “broken windows” policy – deal with petty infractions like jaywalking and the big crimes will look after themselves, ran the theory – had a debatable impact amid nationally falling crime figures, and he was later criticised for rampant police brutality, epitomized by the shooting of the unarmed Amadou Diallo in 1999.

Not to mention that time in 2000 when Giuliani dressed in drag and allowed Trump to smooch his fake breasts in a bizarre portent of things to come.

Presidential candidate

2008 was supposed to be the year when Giuliani cashed in on his reputation as “America’s mayor” to become “America’s president”. And for a while the strategy looked like it was working – he enjoyed the frontrunner position among Republican candidates for months and had a $50m war chest to show for it.

But being in the lead invited adverse media scrutiny, including over his global business links and his friendship with the former New York city police commissioner Bernard Kerik, who was indicted on federal fraud charges shortly before the Republican primaries. He proved to be a wooden and undisciplined campaigner and flamed out at the first big test in Florida.

Global security salesman

Giuliani may have failed to turn his standing as “America’s mayor” into political gold, but he did make financial gold.

He formed Giuliani Partners and through it gained lucrative contracts around the world exporting his “zero tolerance” approach to law and order in New York City – no matter that criminologists have questioned the efficacy of such policies. According to the Washington Post, the business expanded fourfold in its first five years, taking in more than $100m.

Trump cheerleader-in-chief

It’s hard to remember now, but Giuliani used to position himself as a moderate Republican. In the 2008 race he was pro-choice, pro-gay-rights and in favor of greater gun control.

That he is now seen as a rabid rightwinger has everything to do with the unreserved support he extended to Trump in the 2016 presidential campaign. He travelled widely on the campaign trail, lambasting Barack Obama and accusing Hillary Clinton of having been absent after 9/11 (photos showed her standing at Giuliani’s shoulder on 9/12).

Giuliani with the man himself at a campaign rally in North Carolina in September 2016. Photograph: Mike Segar/Reuters

When the Access Hollywood tape in which Trump bragged about grabbing women “by the pussy” surfaced a month before the election, Giuliani was one of very few prepared to defend him. For such loyalty, “the former Rudy Giuliani”, as Stephen Colbert dubbed him, was expected to be rewarded with a prominent position in Trump’s cabinet, but only landed the paltry role of “cybersecurity tsar”.

Until now, that is, when Giuliani finds himself back in that familiar position: under the spotlight and surrounded by controversy.