President Donald Trump fired FBI Director James Comey on Tuesday afternoon.

NBC News reports that several senior FBI and Justice Department officials had no idea about Trump’s plans to fire Comey before he did so. In fact, sources told New York Magazine and other outlets that Comey himself learned about his firing from television, while speaking to FBI agents at the Los Angeles field office.

It was a quick fall from grace for Comey, who shook hands with Trump just days after the election. Comey was also leading into an investigation into possible collusion between the Trump campaign and Russia during the 2016 presidential election.

Here is the complete statement from the White House:

Today, President Donald J. Trump informed FBI Director James Comey that he has been terminated and removed from office. President Trump acted based on the clear recommendations of both Deputy Attorney General Rod Rosenstein and Attorney General Jeff Sessions. “The FBI is one of our Nation’s most cherished and respected institutions and today will mark a new beginning for our crown jewel of law enforcement,” said President Trump. A search for a new permanent FBI Director will begin immediately.

Trump’s letter to Comey, informing him of the decision can be found below. In the statement, Trump told Comey that he agrees with Attorney General Jeff Sessions that Comey can not effectively lead the FBI.

FBI Director Comey has been "terminated and removed from office." pic.twitter.com/z2or0M6oJB — Philip Crowther (@PhilipinDC) May 9, 2017

Below is the Justice Department’s complete letter to the President:

The decision comes just hours after it was reported that Comey’s most recent testimony before the Senate Judiciary Committee included inaccurate information. As ProBublica reports, Comey testified that Hillary Clinton aide Huma Abedin had a “regular practice” of forwarding “hundreds and thousands” of Clinton emails to her husband, Anthony Weiner. Comey said that “some” of these emails “contain classified information.”

However, this information was inaccurate. On Monday, the FBI was preparing to send a letter to Congress this week to tell members that Comey’s statements about Abedin and Weiner’s computer were inaccurate. Sources told ProPublica that Abedin only sent a handful of Clinton emails to Weiner to be printed and that she didn’t have a “regular practice” of doing so.

Comey began serving as the FBI Director in September 2013, after previously serving as U.S. Deputy Attorney General from 2003 to 2005. Comey was widely criticized for publicly releasing a letter to Congress on October 28, announcing that he was re-opening the Hillary Clinton email investigation.

While Comey later announced that the new investigation didn’t reveal any information to make the FBI change its mind about not suggesting Clinton face criminal charges, the damage was already done. Many believe, including Clinton herself, that Comey’s first letter made it possible for Trump to win the election.

“As Nate Silver, who doesn’t work for me, he’s an independent analyst, but one considered to be very reliable, has concluded, if the election had been on October 27th, I’d be your president. It wasn’t,” Clinton told CNN’s Christiane Amanpour last week.

“It makes me mildly nauseous to think that we might have had some impact on the election,” Comey said on May 3 during his Senate testimony. “But honestly, it wouldn’t change the decision.”

But Comey insisted that he made the right decision by going public with the first letter. “Concealment, in my view, would have been catastrophic,” Comey said, even though he knew it would be “disastrous for me personally.”

As for Trump, he tweeted on May 2 that Comey was the “best thing that ever happened to Hillary Clinton in that he gave her a free pass for many bad deeds.”

FBI Director Comey was the best thing that ever happened to Hillary Clinton in that he gave her a free pass for many bad deeds! The phony… — Donald J. Trump (@realDonaldTrump) May 3, 2017

…Trump/Russia story was an excuse used by the Democrats as justification for losing the election. Perhaps Trump just ran a great campaign? — Donald J. Trump (@realDonaldTrump) May 3, 2017

Trump had thought about keeping Comey around until the end of his 10-year term in 2023. Two days after the inauguration, Trump shook hands with Comey and told him, “He’s become more famous than me.”