President Donald Trump fired FBI Director James Comey on Tuesday after senior Justice Department officials concluded that he’d mishandled the investigation of Hillary Clinton’s use of a private email server while she was secretary of state.

“You are hereby terminated and removed from office, effective immediately,” Trump told Comey in a personally signed letter obtained by NBC News.

“While I greatly appreciate your informing me, on three occasions, that I am not under investigation, I nevertheless concur with the judgment of the Department of Justice that you are not able to effectively lead the Bureau,” the president wrote.

Trump acted “on the clear recommendations of both Deputy Attorney General Rod Rosenstein and Attorney General Jeff Sessions,” White House Press Secretary Sean Spicer said in a statement. It said a search for a new FBI director will begin “immediately.”

“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,” the statement quoted Trump as saying.

The FBI said in a letter to the Senate Judiciary Committee on Tuesday that Comey grossly overstated the number of emails that Clinton aide Huma Abedin forwarded to husband, Anthony Weiner, while working at the State Department.

The White House said the dismissal had already been in the works before the FBI acknowledged Comey’s inaccurate testimony. Three senior FBI and Justice Department officials told NBC News that Comey was given no warning in advance.

In his recommendation to Trump, also obtained by NBC News, Rosenstein wrote that Comey mishandled the overall investigation of the email scandal and said he was wrong to have announced last July that the Justice Department’s investigation of Clinton’s emails was being closed.

Referring to Comey’s statement Oct. 28, shortly before Election Day, that more Clinton emails had been found on Weiner’s laptop computer — which Clinton has partly blamed for her loss to Trump — Rosenstein wrote: “We do not hold press conferences to release derogatory information about the subject of a declined criminal investigation.”

“The FBI Director is never empowered to supplant federal prosecutors and assume command of the Justice Department,” he wrote. “The way the Director handled the conclusion of the email investigation was wrong.”

Sen. Lindsey Graham, R-South Carolina, a member of the Judiciary Committee and a frequent critic of Trump’s concurred that Comey’s removal would give the FBI a “fresh start,” given “the recent controversies surrounding the director.”

“I know this was a difficult decision for all concerned,” Graham said in a statement. “I appreciate Director Comey’s service to our nation in a variety of roles.”