Just 11 days before the United States voted Donald Trump president, Director of the Federal Bureau of Investigation (FBI) James Comey surprised everyone by announcing agents had reopened investigations into emails found on Hillary Clinton’s private server.
A week later, the department reiterated the conclusion it had originally reached in July, and cleared Ms Clinton of any wrongdoing. But by that time, her campaign had suffered significant damage and her comfortable lead in the polls had eroded. Mr Comey’s reputation and the future of his job, too, had been brought into question.
But who is James Comey? Some say he sabotaged Hillary Clinton's campaign. And what is he going to do now?
James Brien Comey Junior, born 14 December, 1960, in Yonkers, New York, was appointed director of the FBI by Barack Obama in 2013. He is currently three years into a 10 year term, so he should continue to serve under the future President Trump.
However the Republican is yet to say if he will seek to replace Mr Comey, who he condemned for closing the new email investigation too quickly. He said Mr Comey was part of a "rigged" system, which was working to protect Ms Clinton.
"Right now, (Clinton) is being protected by a rigged system," he told a rally in Sterling Heights, Michigan.
"It's a totally rigged system. You can't review 650,000 emails in eight days. You can't do it folks," Mr Trump said.
Before the controversy, Mr Comey had managed to maintain the respect of both parties.
Although he was appointed by President Obama, the 55-year-old had been a registered Republican. In July 2016, he said he was no longer affiliated to either party. He donated more than $7,000 during the 2008 and 2012 presidential campaigns to Mr Obama's opponents, Arizona Senator John McCain and Mitt Romney.
For most of his career, Mr Comey occupied a comfortable centre-ground.
From January 2002 to December 2003 he was the US Attorney for the Southern District of New York. He was subsequently appointed United States Deputy Attorney General, a position which he held from December 2003 to August 2005. As Deputy Attorney General, Mr Comey was the second-highest-ranking official in the United States Department of Justice, and ran the day-to-day operations of the Department.
One of his first tasks as Deputy Attorney General was to take over the investigation into President Bill Clinton's controversial pardon of financier Marc Rich, who had been indicted on multiple charges before fleeing the country.
The Clinton Library and Hillary Clinton's 2000 Senate campaign were accused of accepting donations from Mr Rich's ex-wife Denise in exchange for letting him off, but the Clintons were cleared and Mr Comey dropped the case.
Mr Comey himself had overseen Rich’s prosecution between 1987 and 1993.
On 1 November 2016, the FBI released documents on the Marc Rich case, but excluded documents pertaining to the FBIs decision not to pursue the case.
Later, Under President George W Bush, Mr Comey became known for blocking central aspects of a National Security Agency wire-tapping operation, which he said were illegal.
Although he was condemned for that action, many human rights and civil liberties advocates have said they are not impressed by Mr Comey’s overall record. The American Civil Liberties Union said in a statement: “As the second-highest ranked Justice Department official under John Ashcroft, Comey approved some of the worst abuses committed by the Bush administration.
"Specifically, the publicly available evidence indicates Comey signed off on enhanced interrogation techniques that constitute torture, including waterboarding. He also oversaw the indefinite detention without charge or trial of an American citizen picked up in the United States and then held for years in a military brig."
The Union added: "Although Comey, despite tremendous pressure from the Bush White House, deserves credit for courageously stopping the reauthorization of a secret National Security Agency program, he reportedly approved programs that struck at the very core of who we all are as Americans.”
However, the most serious threat to his reputation came with his intervention in the vicious political battle between Ms Clinton and Mr Trump for the White House.
Democrats have accused him of influencing the final days of an already vitriolic campaign, while Republicans accused him of caving to political pressure.
Dianne Feinstein, the top Democrat on the Senate Select Committee on Intelligence, said Mr Comey "unfairly hurt the campaign of one candidate and changed the tenor of this election".
Former House Speaker Newt Gingrich tweeted on Sunday: "The destruction of James Comey by political pressure is painful to watch. He is being twisted into an indefensible pretzel of contradictions."
At 6ft 8ins tall, he used to play basketball. He is of Irish descent and was raised Roman Catholic, but joined the United Methodist Church as an adult.
Mr Comey and his wife Patrice Failor have five children together.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies