President Donald Trump fired FBI Director James Comey on Tuesday, citing the bureau’s handling of Hillary Clinton’s email investigation.
The move follows months of criticism by Democrats and Republicans over the bureau.
But the firing also reflects deep divisions within the bureau, where Republicans and Democrats have differed over the way the bureau should respond to potential future investigations.
Comey had been leading an investigation into the ties between Russia and Trump associates, including his former campaign chairman Paul Manafort.
The former FBI director was replaced in March after a series of White House controversies, including allegations that he had illegally gathered documents from the Democratic National Committee.
In a memo he wrote last month, Comey said he felt the FBI was being too politicized and was resigning as part of the bureau being independent from political influences.
“The Department of Justice must not become an instrument for political ends, and the FBI must remain focused on our country’s core mission of protecting and serving the American people,” Comey wrote.
“I am resigning to allow the Department of the Justice to lead this great institution to the highest ethical and legal standards.”
Comey had served as FBI director since 1999.
The bureau has been under intense scrutiny by both political parties in recent years, with Democrats accusing it of stonewalling the congressional probes into Russian interference in the 2016 presidential election and for not taking any action on its own, even when the investigation into former national security adviser Michael Flynn became public in January.
In January, Democrats launched a probe into Comey and his handling of the investigation.
At the time, the Senate Judiciary Committee was investigating the FBI for possible ties between Trump’s campaign and Russian operatives.
Comey was under investigation for his handling, and Trump was considering whether to fire him.
The White House has argued that the firing of Comey is part of a larger political vendetta against him.
“Comey’s actions over the last six months have not been good for the American public or the bureau,” White House press secretary Sarah Huckabee Sanders said.
“We need to make sure that the people at the FBI are doing their jobs well and protecting the American citizens and not getting in the way of the president.”
The bureau was the first agency to publicly announce that it was stepping up its investigation into Flynn.
The FBI is one of two law enforcement agencies that has the authority to publicly reveal investigations into political officials and their aides.
The Justice Department’s inspector general has also been investigating the bureau over its handling of Flynn, which was a key factor in Trump’s decision to fire Comey.
The investigation was led by the FBI’s former deputy director, Andrew McCabe, who was promoted to FBI director in March.
The Trump administration has repeatedly defended the FBI.
The president has repeatedly called for Comey to be fired, arguing that he should not have been fired in the first place.
In February, he asked Attorney General Jeff Sessions to fire the FBI director for what he described as a “very weak job” and for mishandling the Clinton email probe.
Sessions later recused himself from the investigation after revelations that he discussed the matter with the Russian ambassador during a White House meeting.
Comey also faced pressure in March to resign after he announced he was writing a book about his time as FBI chief.
The book, which will be published in 2018, comes as the bureau is still investigating Flynn.