It is easy to forget, and in some ways difficult to imagine, that Rudy Giuliani was once revered for his integrity. He was seen by many as a hero long before Sept. 11, a seemingly fearless U.S. attorney who broke the back of the mob, took on Wall Street titans and sent political power brokers to prison.

With each sensational indictment handed down by his office in the 1980s, Mr. Giuliani spoke like the priest he almost became about good and evil, and the seductions of power and money.

“It’s a rare individual in public office who does not eventually become personally corrupt,” he said in 1988.

The comment takes on new meaning when you read through the Georgia grand jury’s indictment, Mr. Giuliani’s first as a defendant. The details make it clear that the crusader of the 1980s and 1990s has completely lost his ability to distinguish right from wrong. He has gone from a moral compass in a city teeming with corruption to a long-ago leader who has descended into a moral void.

He stands accused of participating in a wide-ranging conspiracy to upend the 2020 presidential election. It’s a remarkable irony, and a catastrophic blow to his legacy, that the Fulton County, Ga., district attorney, Fani Willis, has brought charges against him under a version of the federal RICO law that Mr. Giuliani famously employed against the Mafia. The indictment also portrays his venal, if stumbling, efforts to employ his old prosecutorial gifts to Donald Trump’s advantage.

Today Mr. Giuliani is 79 years old and seems lost in a fog, a confused man railing on X, previously known as Twitter, about Joe and Hunter Biden and bragging about decades-old accomplishments as if his work for Mr. Trump had not turned him into a figure of ridicule and contributed to two presidential impeachments. He has been drowning in criminal investigations, lawsuits and defamation cases, and is apparently burning through the vast sums that he earned over his career, much of it from consulting and speaking fees after 9/11. He now makes Cameo videos for $325 apiece.

Yet the indictment is a vivid reminder of how dangerous he was in the Trump years. In the former president’s last months in office, an untold number of Trump White House and campaign lawyers and even the attorney general labored to convince Mr. Trump that he had lost the election. But it was Mr. Giuliani who had the president’s ear. And he was telling Mr. Trump that he had won.

Predictably, Mr. Trump named him to lead the postelection legal fight. Mr. Giuliani dove into the work, seemingly more than willing to cross legal and ethical lines, evolving from prosecutor to transgressor. He used his understanding of the criminal mind not to enforce the law, but to propagate what the grand jury describes as a conspiracy.

A prosecutor’s job is to weave together a compelling story out of a blizzard of facts and paint a vivid picture to jurors in a trial. Mr. Giuliani was a master of the art. As an assistant U.S. attorney for the Southern District of New York, in 1974, he accused then-Representative Bertram Podell of being “a United States congressman who agreed to sell the influence of his office for money.” At trial, he conducted a withering cross-examination that rattled the congressman so much that he changed his plea to guilty. It made Mr. Giuliani’s career.

His formidable talents brought him to the highest levels of the Justice Department and won him public adoration. With each victory he spoke from a moral pedestal. “If we can teach our entire society that no matter how powerful you are … you have to pay a price when you violate the law,” he said shortly before landing a racketeering conviction in 1987.

In the years that followed, he applied those prosecutorial gifts to his own career, cultivating a heroic image: America’s greatest corruption fighter; the mayor who cleaned up New York; the personification of leadership on Sept. 11. The dramatic story line overshadowed acts of callousness — cheating on his wives, according to friends and colleagues; slandering Patrick Dorismond, an unarmed Black man who had been killed by an undercover detective; cashing in on his 9/11 fame; and pursuing political and legal misadventures for President Trump in Ukraine.

With his ethical bedrock crumbling, Mr. Giuliani attempted to put his old skills to work in 2020 and spin a gripping story to Mr. Trump’s advantage.

On Dec. 3, he brought the stolen election claims to Georgia, a pivotal state that Joe Biden had surprisingly won. He was welcomed by Republicans at a Georgia State Senate committee hearing at the state capital, where he claimed, falsely, that Dominion Voting Systems equipment had turned Trump votes into Biden votes, and that almost 100,000 nonexistent mail-in ballots were counted. Mr. Giuliani looked on as a member of his team falsely characterized a video showing vote counters pulling out ballot containers from under a desk in Atlanta’s State Farm Arena on election night and alleged, falsely, that the containers were “suitcases” filled with illegal ballots.

A week later, Mr. Giuliani made a presentation to the Georgia House in which he accused two election workers of “quite obviously surreptitiously passing around USB ports as if they’re vials of heroin or cocaine.” (He recently admitted in a civil court filing that he made false statements about the election workers.) The picture he painted in the Georgia House was as vivid as it was dishonest. The Georgia indictment laid it out in great detail.

“This is going to be the election that will be the dirtiest election, the most crooked election, the most manipulated election in American history,” Mr. Giuliani said at a third December appearance in front of the Georgia legislature. “Georgia is going to be at the center of it because you have what I call the Zapruder film. … If you can watch that and not realize that this was a major situation of voter fraud, then you’re a fool or a liar.”

As he traveled from state to state, hearing to hearing, an increasing number of people inside and outside of the White House threw cold water on his claims. After Georgia’s secretary of state’s office proved his most serious charges patently false, Mr. Giuliani’s accusations began to irk Trump campaign officials.

“When our research and campaign legal team can’t back up any of the claims made by our Elite Strike Force Legal Team, you can see why we’re 0-32 on our cases,” one senior adviser wrote on Dec. 8, according to one of the federal indictments against Trump. “I’ll obviously hustle to help on all fronts, but it’s tough to own any of this when it’s all just conspiracy shit beamed down from the mothership.” Two days later, Mr. Giuliani was in front of the state legislature, saying, “every single vote should be taken away from Biden.”

His fabrications did not stop with false claims about the video. He helped oversee the scheme in which false elector certificates were submitted in favor of Mr. Trump rather than Mr. Biden.

Mr. Giuliani had another lawyer send memos to Trump points of contact in several states, explaining how they could mimic legitimate electors, but the memo didn’t mention that they intended to disrupt the certification of Mr. Biden’s victory on Jan. 6. When some Trump false electors in Pennsylvania expressed concerns about participating, Mr. Giuliani assured them that the certificates they signed would be used only if Mr. Trump won certain litigation according to one of the federal indictments. He didn’t appear to give any such assurances to the fake electors from other states, and the false certificates with their names were submitted. False electors from Michigan are now facing state charges.

On the night of the Jan. 6 attack on the Capitol, Mr. Giuliani placed calls to members of Congress in an attempt to continue to spread the debunked charges in hopes of buying time to delay certification of Mr. Biden’s victory, according to one of the federal indictments against Mr. Trump. “Georgia gave you a number in which 65,000 people who were underage voted,” he said in a phone message that federal prosecutors claim was intended for a U.S. senator. The correct number was zero.

After spending years of his life escaping the shadow of his father’s criminal past — Harold Giuliani served a year and four months in Sing Sing for robbing a milkman — Mr. Giuliani put his future and even personal freedom on the line for Mr. Trump. He is now facing prison time himself.

Faced with the political irrelevance and collapsing client base that would accompany Mr. Trump’s defeat, he seemingly made a Faustian bargain, working to undermine democracy in order to save his career. He was ultimately thwarted by the rule of law, and his own bumbling. The disaster he has made of his life, and the ruination of his legacy, are of his own making.

“I am a basically simple person,” Mr. Giuliani told a reporter back in 1989. “I think there are rules, [and] you have to try to live as best you can by those rules. If those rules are laws, you had better darn well live by them.”

After a half-century crafting, enforcing and then breaking those rules, Mr. Giuliani is now faced with the reality that they apply to him.

Andrew Kirtzman is the author of “Giuliani: The Rise and Tragic Fall of America’s Mayor,” for which David Holley served as the researcher.

The Times is committed to publishing a diversity of letters to the editor. We’d like to hear what you think about this or any of our articles. Here are some tips. And here’s our email: letters@nytimes.com.

Follow The New York Times Opinion section on Facebook, Twitter (@NYTopinion) and Instagram.