James Comey came to the FBI with a hero's reputation: He famously stood up to President George W. Bush's aides in a dramatic hospital-room confrontation over secret wiretapping.
He had few enemies in Washington when he took the helm of the FBI on a 93-1 Senate vote in 2013.
But by the time President Donald Trump unceremoniously dumped him late Tuesday, Comey had few clear friends left in town -- with his reputation under siege. His critics on both the left and the right attacked his handling of probes into Hillary Clinton's emails, Trump's Russia ties, and more.
The sudden firing threw into doubt the independence of the FBI's ongoing Russia investigation and the stability of the bureau itself, which has been wracked by charges that Comey's political meddling in the fall campaign compromised its mission.
The Justice Department inspector general has been investigating Comey's handling of the Clinton email investigation and other campaign controversies since last fall, but the rapid-fire events on Tuesday added a historic level of drama to a story that has gripped Washington for months.
Not since the infamous "Saturday Night Massacre" at the height of the Watergate scandal has the delicate relationship between the White House and the FBI been thrown into such turmoil.
On that night in 1973, President Richard Nixon fired a series of top Justice Department officials after they refused to fire a special prosecutor who was investigating the Watergate abuses.
Democrats, who had savaged Comey for his handling of the Clinton email investigation, reversed course and portrayed him Tuesday not as a villain, but as a victim. They quickly cast the firing in Nixonian terms and accused Trump of trying to quash the ongoing Russia investigation.
Congressman Adam Schiff, the ranking Democrat on the House intelligence committee, called the firing "brazen interference" in the FBI's investigation.
Even Republican Senator Richard Burr, who is leading a Senate intelligence committee probe into alleged Russian influence on the election, expressed concern over Comey's firing: "I am troubled by the timing and reasoning of Director Comey's termination," he said in a statement.
Comey said last week at a Senate hearing that he was pained and "mildly nauseous" over the thought that his actions might have affected the presidential election.
But he said he had no regrets, and he had shown no indication he thought his job was in jeopardy. He has even ticked off the exact number of days he had left until his 10-year term expired in 2023 -- a term he expected to complete.
The political attacks were a remarkable turn for the 6'8" Comey, a towering and charismatic figure who had risen to power with seeming effortlessness earlier in his career.
As a federal prosecutor in Richmond, Va. in the 1990s, Comey earned high marks for a novel program that saw long prison terms for felons who used guns in their crimes. He was then given the coveted job of US Attorney in Manhattan -- before President Bush tapped him to become the second-ranking official for the entire Justice Department.
In that post, Comey burnished his reputation as an honest broker willing to stand up to power -- even at the risk of his own job.
In 2004, when his boss, Attorney General John Ashcroft was hospitalized with severe pancreatitis, Comey refused to sign off on a secret eavesdropping program approved by Bush after the Sept. 11 attacks because he believed it might be illegal.
Two of Bush's aides, Alberto Gonzales and Andy Card, raced to the hospital to try to get Ashcroft's bedside signature to continue the wiretapping program.
But Comey, with sirens blazing on his security detail's car, beat them there and raced up the stairs to his boss's hospital room, where Ashcroft stood by his underling's decision.
The episode became a part of the Comey lore when it was first revealed publicly more than a year later.
As director of the FBI, Comey spoke frequently and passionately about distancing the bureau from the dictatorial days of J. Edgar Hoover's 48-year reign.
On his desk at the FBI, he kept a copy of a letter from Hoover for the wiretapping of wiretap Martin Luther King Jr. -- a dark reminder, Comey said, of the bureau's abusive past.
With public opinion turning on him over the Clinton email investigation, however, Comey appeared to realize that he was becoming increasingly isolated after years of stardom.
At a memorial service for a prosecutor held at a packed Justice Department auditorium just days before the November election, Comey joked sardonically in a eulogy about how unpopular he seemed to have become in the eyes of some colleagues.
His own memorial service, he suggested, would no doubt be held in a much smaller venue.