(CNN) President Donald Trump on Tuesday fired the man leading the federal investigation into his campaign's alleged ties to Russia.

James Comey was dismissed from his post as FBI director, the White House said, on the recommendation of Deputy Attorney General Rod Rosenstein and Attorney General Jeff Sessions. They cited Comey's handling of the probe into Hillary Clinton's use of a private email server, a controversy that many believe helped Trump defeat the Democratic nominee in the 2016 presidential election.

At a glance, Comey, a career prosecutor, is an unlikely candidate to take center stage in the most charged political drama of this generation, but history shows he has a tendency to turn up in the headlines.

Here are seven things to know about James Comey:

He delivered an unprecedented "October Surprise" last year

Comey announced on October 28, 2016 -- less than two weeks before the presidential election -- that the bureau would investigate more emails potentially related to Hillary Clinton's private server. The news sent a jolt through the political world, setting off alarm and anger among Democrats who worried the news would swing the election to Trump.

Clinton has said she believes Comey's decision did just that, saying last week , "If the election had been on October 27, I would be your president." Still, when Comey's dismissal was made public late Tuesday, former Clinton staffers, many of whom had been harshly critical of Comey, suggested on Twitter that Trump's decision was politically motivated.

The story, though, goes back further than that. In July 2016, Comey invited scorn from Republicans -- and quiet frustration from Democrats -- when he revealed his office's decision not to recommend charges against Clinton, though not before publicly excoriating the candidate for her actions.

He opposed Bush White House officials in a dramatic standoff

Comey, who was appointed to a 10-year term that would have carried into the next administration, came into national prominence in 2007 when, during testimony to the Senate Judiciary Committee, he told the story of a tense standoff over a federal domestic surveillance program with top officials from the administration of President George W. Bush. (Comey had been tapped as a deputy US attorney general under Bush in 2003.)

The incident took place in the evening of March 10, 2004, according to Comey's account, with then-Attorney General John Ashcroft ill and incapacitated in a hospital intensive care unit.

Top White House lawyer Alberto Gonzales (who would later become US attorney general) and Bush Chief of Staff Andrew Card had raced to Ashcroft's side in an effort to have him sign off on an extension to the wiretapping program, which Justice Department attorneys had deemed illegal. The weakened Ashcroft managed to make clear his refusal and Gonzales and Card left the room -- with Comey, then Ashcroft's top deputy, watching on -- without a word.

He prosecuted Martha Stewart

When lifestyle guru Martha Stewart was indicted in 2003 on a series of charges connected to a dodgy 2000 stock deal, it was Comey who brought the charges.

''This criminal case is about lying -- lying to the FBI, lying to the SEC, lying to investors," Comey, then a US attorney for the Southern District of New York, said at a press conference. ''Martha Stewart is being prosecuted not for who she is, but because of what she did.''

Stewart was convicted on all counts in 2004 and sentenced to five months in prison. She served her time and was released in March 2005.

He'd investigated the Clintons previously

In fact, the email server probe marked the third time Comey has investigated Bill or Hillary Clinton.

Their first run-in came in the mid-1990s, when Comey joined the Senate Whitewater Committee as a deputy special counsel. There he dug into allegations that the Clintons took part in a fraud connected to a Arkansas real estate venture gone bust. No charges were ever brought against either Clinton, but the scandal would eventually lead to independent counsel Kenneth Starr's probe that would result in the Lewinsky scandal.

In 2002, Comey, then a federal prosecutor, took over an investigation into President Bill Clinton's 2001 pardon of financier Marc Rich, who had been indicted on a laundry list of charges before fleeing the country. The decision set off a political firestorm focused on accusations that Rich's ex-wife Denise made donations to the Democratic Party, the Clinton Library and Hillary Clinton's 2000 Senate campaign as part of a plan to get Rich off the hook. Comey ultimately decided not to pursue the case.

The kicker: Comey himself had overseen Rich's prosecution between 1987 and 1993.

He was locked up and held at gunpoint by a high-profile serial criminal as a teen

Comey's first brush with the law was a traumatizing one.

In October 1977, he and his younger brother were held captive in their home by the so-called "Ramsey Rapist." The armed man, who cops were hunting following a series of home invasions, had recently assaulted two babysitters in the area.

According to an account in the Bergen Record , the Comey brothers were held at gunpoint and locked in a bathroom inside their family's Allendale, New Jersey, house. They escaped through a window but were confronted outside by the suspect before bolting back in and contacting police.

He was overwhelmingly confirmed by the Senate in 2013

Comey became the seventh FBI director when he was confirmed by the Senate on July 29, 2013, by a 93-1 count, with Sen. Rand Paul the lone holdout. The Kentucky Republican had threatened to block Comey's nomination, but relented and allowed a vote after being further briefed on FBI drone surveillance policy.

Comey succeeded Robert Mueller III, who had held the job for the previous 12 years.

He was a registered Republican for many years

In testimony on Capitol Hill, Comey insisted that his FBI is "resolutely apolitical."

Comey himself, however, does have a partisan past -- as a Republican.

"I have been a registered Republican for most of my adult life," he said before adding that he is "not registered any longer."

Editor's note: This story, first published in July, has been updated after FBI Director James Comey was fired by President Trump on Tuesday evening.