Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

The man behind one of the biggest bombshells of the presidential election has never been one to follow tradition.

Politically, FBI Director James Comey has been a registered Republican for most of his life. Personally and professionally, he is fiercely independent — so much so that President Barack Obama didn't hesitate to appoint him to his current position, despite Comey's history of donating to Republican presidential campaigns.

Related: The Case That Hillary Clinton Can't Shake: A History of the Email Controversy

A career prosecutor, 55-year-old Comey has a history of defying both political parties.

But no past action has thrust him into the cross hairs quite like his announcement Friday — a mere week and a half before voters go to the polls — that a newly discovered batch of emails had prompted him to take another look at the email investigation that has dogged Democratic nominee Hillary Clinton throughout her candidacy.

"He recognizes that you can never make everybody happy."

Friends say Comey's work has instilled in him a deep sense of doing the right thing, even if it's unpopular. That has meant positioning himself against big names in the past, including the Clintons, whom he has investigated twice before.

"I don’t think he takes glee in being contrary for its own sake," Daniel Richman, a law professor at Columbia University who has been a close friend of Comey's for 30 years and was a former colleague of his at the U.S. Attorney's Office in New York, told NBC News.

But, he added, "he recognizes that you can never make everybody happy."

FBI Director James Comey attends a new Implicit Bias Training program at the Department of Justice in Washington, DC, June 28, 2016. SAUL LOEB / AFP - Getty Images

Prior to becoming FBI director in 2013, Comey was best known for a 2004 incident that he has referred to as "the most difficult night of my professional life." It took place in a darkened intensive care unit where then-Attorney General John Ashcroft was recovering from emergency pancreas surgery.

Comey at the time was deputy attorney general at the Department of Justice, which had just deemed President George W. Bush's domestic surveillance program illegal. He received a phone call that White House Counsel Alberto Gonzales and Bush's chief of staff, Andrew Card, were going to Ashcroft's bedside to convince him to reauthorize the program.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Comey raced to the hospital, where he found a critically ill Ashcroft who summoned the strength to tell Gonzales and Card he refused to sign their papers, Comey testified in 2007.

Gonzales and Card's "effort to take advantage of a very sick man" so infuriated Comey that he prepared a letter of resignation, he said.

The reauthorization was eventually overruled by Bush himself — but only after Bush found out that Comey, along with other top staff, including Ashcroft, were preparing a mass exodus.

A Yonkers, New York, native, Comey climbed the ladder as an assistant U.S. attorney and then as U.S. attorney for the Southern District of New York. While serving in that role in 2003, Comey brought charges against homemaking maven Martha Stewart for her shady stock sale several years prior.

''Martha Stewart is being prosecuted not for who she is, but because of what she did," he said.

Comey also probed the Clintons before.

The first time was in 1996, when Comey joined the Senate Whitewater Committee as deputy special counsel.

The inquiry focused on whether then-President Bill Clinton had abused his power as Arkansas governor to benefit the Whitewater Development Corporation, a real estate business partner of the Clintons'.

The case had faint echos of today's Clinton investigation: Comey concluded that Hillary was involved in mishandling documents. He also found that the couple had engaged in “a highly improper pattern of deliberate misconduct.”

No charges were brought against the Clintons, although others were prosecuted.

Then, as New York's top prosecutor in 2002, Comey investigated Bill Clinton for his pardoning of Marc Rich, an international financier, for tax evasion. Despite later telling Congress he was "stunned" by the pardon, Comey eventually concluded there hadn't been any criminal wrongdoing.

At 6-foot-8, Comey is "a man who stands very tall for justice and the rule of law," Obama has joked.

While he donated to the Republican presidential campaigns of John McCain in 2008 and Mitt Romney in 2012, Comey says he prefers to avoid entering the political fray.

In July, when he announced the FBI's initial decision to not pursue a case against Clinton, he testified: "I have been a registered Republican for most of my adult life, not registered any longer." He also called the FBI itself is "resolutely apolitical."

His longtime friend said he was certain there was no political malice involved with Comey's decision to re-examine Clinton's emails.

"When you have an obligation to disclose or to qualify, you do it full-stop. You don’t worry about timing, you don’t worry about how it will be read or spun by others," Richman said. "And in this case, when he learned that what he said to Congress about the review of emails being complete turned out to be dated and requiring correction, he did it. There’s no calculus involved."

A father of five, Comey and his wife Patrice met at the College of William and Mary. The couple had a sixth child, a son who died of an infection in infancy in 1995.

While he's often serious, those who know him describe him as affable and open, too.

President Barack Obama arrives alongside new FBI Director James Comey, Comey's wife, Patrice Failor, and FBI Deputy Director Sean Joyce during an installation ceremony at Federal Bureau of Investigation Headquarters in Washington, DC, Oct. 28, 2013. SAUL LOEB / AFP/Getty Images

Comey has quipped that at a towering 6-foot-8, he literally stands out as the tallest FBI director ever — and even Obama has gotten in on the joke.

In 2013, Obama introduced Comey as his pick for FBI director during an announcement in the White House Rose Garden, where he stood side-by-side with the imposing prosecutor.

"Now, I think [outgoing FBI director Bob Mueller] will agree with me when I say we have the perfect person to carry on this work in Jim Comey," Obama said, "a man who stands very tall for justice — and the rule of law."