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.
Deputy FBI Director Andy McCabe will take over temporarily as acting director, Attorney General Jeff Sessions told FBI employees in a message obtained by NBC News.
White House Press Secretary Sean Spicer said in a statement that Trump acted "on the clear recommendations" of Sessions and Deputy Attorney General Rod Rosenstein. He said a search for a new FBI director would begin "immediately."
The FBI has been investigating allegations that people involved with Trump's presidential campaign had undisclosed ties to Russia. But during a brief meeting with NBC News in the Oval Office on Tuesday evening, Trump said the Russia probe wasn't a factor in his decision.
The distinction is crucial, because Sessions signed off on Comey's dismissal even though he has recused himself from involvement in the investigation of Russia's ties to the presidential campaign.
Deputy White House Press Secretary Sarah Huckabee Sanders told reporters Tuesday night that Comey's inaccurate Senate testimony last week "showed that he was incapable of continuing to do his job."
"Here's the bottom line: Comey had lost the confidence across the board, from House members, from Senate members, from rank-and-file members of the FBI and the American public," Sanders said.
In his letter to Comey, the president wrote: "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."
Let our news meet your inbox. The news and stories that matters, delivered weekday mornings.
Republicans and Democrats alike said the dismissal called the FBI's independence into question, and many Democrats immediately called for appointment of an independent counsel to take over the Russia investigation.
The White House said the dismissal had already been in the works before the FBI acknowledged Comey's inaccurate testimony. But three senior FBI and Justice Department officials told NBC News that Comey was given no warning.
Federal officials said Comey was in the FBI's Los Angeles operations center when he got a call notifying him that he had been fired. Employees in the office, aware of the news reports, gathered outside the center and gave him an ovation as he came out.
Senior FBI officials who convened a conference call afterward were described as "stunned," officials told NBC News. They said Comey himself was "shocked."
Referring to Comey's statement on Oct. 28 that more Clinton emails had been found on a laptop computer belonging to Anthony Weiner, the husband of top Clinton aide Huma Abedin, 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. Chuck Grassley, R-Iowa, chairman of the Judiciary Committee, said in a statement: "The effectiveness of the FBI depends upon the public trust and confidence. Unfortunately, this has clearly been lost."
But Sen. Patrick Leahy of Vermont, a Democrat on the committee, called the move "shocking."
"No one should accept President Trump's absurd justification that he is now concerned that FBI Director Comey treated Secretary Clinton unfairly," Leahy said in a statement. "This is nothing less than Nixonian."
Rep. John Conyers of Michigan, ranking Democrat on the Judiciary Committee, and the ranking Democrats on five Judiciary subcommittees sent a letter to Rosenstein and McCabe on Tuesday night demanding that the Justice Department and the FBI preserve all documents relating to both Comey's dismissal and the Russia investigation.
"The Trump administration cannot be allowed to interfere any further in this investigation," they wrote, adding: "Nothing less than the integrity of our leading independent law enforcement agency and the credibility of our democracy are at stake."
Representatives of Clinton and former President Barack Obama said they had no immediate comment. But other Democrats calling for an independent investigation of the Trump campaign's alleged Russia ties included Sens. Kirsten Gillibrand of New York, Bill Nelson of Florida and Jeff Merkley of Oregon.
Even as those calls mounted, the White House confirmed Tuesday night that the president would meet with Russian Foreign Minister Sergey Lavrov in the Oval Office on Wednesday.
While the president has the legal authority to fire the FBI director, it has happened only once before, in 1993, when President Bill Clinton dismissed William Sessions after an internal watchdog found that he had improperly billed the FBI for personal spending.
Alex Johnson is a senior writer for NBC News covering general news and technology and religion. He is based in Los Angeles.
Hallie Jackson is the chief White House correspondent for NBC News.
Pete Williams, Tom Winter, Ken Dilanian, Andrea Mitchell, Ari Melber , Frank Thorp V, Abigail Williams , Andrew Blankstein and Monica Alba contributed.