Rudolph W. Giuliani — the former New York mayor and onetime presidential candidate — is now mainly known as President Trump’s personal attorney, and it is in that position that he has returned to national headlines. He has made himself central to the Ukraine whistleblower story — using business and political ties in Ukraine to search for material relevant to Trump’s political interests and positioning himself as Trump’s most visible surrogate in the media as the whistleblower scandal has broken into the open.

It’s not the first time former admirers have expressed awe — and not the good kind — about what has become of the man who was dubbed “America’s mayor” in the aftermath of the Sept. 11, 2001, terrorist attacks. Giuliani had a nearly 80 percent approval rating — his highest ever — four weeks following the attacks, according to a Quinnipiac poll. And he often leaned heavily on that goodwill — as former vice president Joe Biden previously noted — to prop up his 2008 presidential campaign.

Recent weeks are just a reminder of how much perception of him has changed since that time.

But for others, particularly those people of color who lived in New York City when Giuliani was mayor, Giuliani’s legacy was less than the stuff of legend.

Giuliani reemerged as a household name during the 2016 presidential campaign as a surrogate for Trump, taking the stage at rallies to champion his candidate and popping up on cable news to defend Trump’s vision of a great America. But for those who have criticized Trump’s agenda as exclusionary, xenophobic and racist, Giuliani’s embrace of the president makes perfect sense.

Peter Noel, who took a critical look at Giuliani’s handling of race relations in his book “Why Blacks Fear ‘America’s Mayor’,” said Giuliani made his way to perhaps the most powerful seat in New York politics in part as a reaction to the administration of David Dinkins, the first and only black mayor of New York, in ways that mirror Trump’s election after the administration of Barack Obama, America’s first black president.

“He pretty much ran on a platform that claimed, ‘This black mayor ran the city into the ground and I’m going to bring back some civility,’ ” Noel said. “He pretty much took up the mantle, took up that fight and he said, ‘I can do this. I can run for mayor and I think I can win.’ ”

“He ran on the basis that he was going to clean up the city,” Noel added.

For Giuliani, who was mayor from 1994 to 2001 and U.S. attorney for the Southern District of New York from 1983 to 1989, cleaning up the city meant implementing policies and a posture that many black residents found racially insensitive.

When then-Rep. Charles B. Rangel (D.-N.Y.) and other black political leaders criticized Giuliani in January 1994 for not doing enough to reach out to black community leaders to improve his standing with black residents, Giuliani told the New York Times: “They’re going to have to learn how to discipline themselves in the way in which they speak also.”

The comment was deemed offensive and condescending but came to exemplify Giuliani’s leadership style for many people of color in the city.

In his run for mayor, Giuliani ran a racially charged campaign geared toward attacking Dinkins, accusing him of retreating “into black victimization.”

Once he was in office, one of his most controversial initiatives was stop-and-frisk, a policy that allowed New York police officers to detain and search people for often vague pretexts. As The Washington Post’s Philip Bump reported in 2016, the major problem with stop-and-frisk was that it was disproportionately used in communities of color. According to New York Civil Liberties Union data, more than half of those detained and searched under that policy were black, and nearly a third were Latino.

Giuliani, who enjoyed support from many police officers, also showed an unwavering allegiance to the NYPD, which raised concerns among communities of color. His defense of NYPD officers after they fired 41 shots at Amadou Diallo, a 23-year-old Guinean immigrant they mistook for a rape suspect, and his comments about Patrick Dorismond, a 26-year-old black security guard killed by undercover officers, attracted significant criticism.

Giuliani authorized the release of Dorismond’s arrest record immediately after the police shooting to make the case that the security guard had a pattern of behavior that contributed to his death. “That Mr. Dorismond spent a good deal of his adult life punching people is a fact,” Giuliani said at a March 2000 news briefing about the shooting.

Sean Deveney, author of “Greed and Glory: The Rise and Fall of Doc Gooden, Lawrence Taylor, Ed Koch, Rudy Giuliani, Donald Trump, and the Mafia in 1980s New York,” said many city residents felt that Giuliani’s plan to clean up the crime that dominated New York in the 1980s became so all-consuming that he did little to factor in how his actions affected the people in those communities, and that perception stuck.

“As a federal prosecutor, he didn’t really have the tools to deal with that,” Deveney said. “So he felt like if he did get that power, he was going to clean up the city, clean up the blight he saw during the 1980s, and carried that goal into his experience as mayor. And that’s why those communities that sort of suffered from that, that’s why a lot of those communities were alienated by Giuliani.”

Giuliani’s affiliating himself with Trump, who has suffered from perpetually low approval ratings from people of color, may eventually lead to irreparable damage to his reputation. And given Giuliani’s most recent activities — not just defending Trump but potentially engaging in corrupt activities himself — even those who once viewed the former mayor charitably may no longer see him that way.

“Even the white folks who applauded him for cleaning up the city now have seen that this guy has become a different animal,” Noel said. “They are seeing a political animal — someone who has debased himself to back Donald Trump.”

Said Deveney: “If you could go back 35 years and ask Rudy Giuliani of 1984 — the guy who was putting the heads of the five [mafia] families on trial, the guy who was taking on a major corruption case in the [New York] parking violation bureau — what was going to be his legacy, I don’t think he would approve very much” of his own recent actions.

He added, “He was someone who really took corruption on and seemed to take it personally when other people would use their office and public trust for their own personal gain.”