President Donald Trump has fired FBI Director James Comey.

The stunning and sudden removal comes after Comey told Congress in March that the FBI was engaged in an ongoing investigation into the Trump campaign and its potential ties to Russia; Comey’s firing also follows the dramatic dismissal of acting Attorney General Sally Yates in January.

Senior White House officials told The Daily Beast on Tuesday evening that the administration had been working out the details of exactly how to fire Comey “for several days now,” in the words of one of those officials.

Another administration official said the decision—which caught FBI officials and top lawmakers completely off-guard on Tuesday—was “kept very close to the chest” within Trump’s inner political circle until the moment “[we] were ready to pull the trigger” on axing Comey. Many Trump aides were as surprised by the news of the firing as FBI officials who learned about Comey’s fall on the evening news.

“We are trying to get our heads around this like [you],” one aide said shortly after the news broke.

Comey’s removal, which marked just the second time in U.S. history that a president has fired a sitting FBI director, also came as a shock to some members of Congress.

News of Comey’s dismissal came just hours before CNN reported that the Justice Department has issued subpoenas to private business associates of former national security adviser Michael Flynn as part of its investigation into Russian presidential election meddling. Flynn has faced scrutiny over a five-figure payment in 2015 from Russian state-owned broadcaster RT.

“I’m surprised. I just don’t have a clue. I genuinely need to digest a little a bit,” said one stunned congressman who is involved in FBI oversight, after Comey’s dismissal. “I would fail at the proper way to communicate this right now.”

The Comey firing comes two days before he was scheduled to appear before the Senate Intelligence Committee in an open hearing, to testify about “worldwide threats.” Questions about the FBI’s investigation into possible Trump-Russia ties would have likely surfaced.

On Tuesday night, CNN aired a report detailing how Keith Schiller, Trump’s longtime private-security head and White House body-man, was dispatched to hand-deliver President Trump’s letter in a manila envelope to the FBI.

The White House said in a statement Trump fired Comey based on recommendations from Attorney General Jeff Sessions and Deputy Attorney General Rod Rosenstein. Sessions and Rosenstein cited Comey’s handling of the Hillary Clinton email investigation, accusing him of “usurping” the powers of the prior attorney general and announcing the investigation was closed.

The president went after Comey directly last week, writing on Twitter that Comey “was the best thing that ever happened to Hillary Clinton in that he gave her a free pass for many bad deeds!”

The White House’s announcement came less than an hour after the FBI was forced to correct comments that Comey made at a Senate Judiciary Committee hearing last week regarding the scale of classified information mishandled by a top aide to Clinton, the former Democratic presidential candidate (PDF).

Comey has drawn intense fire from both sides of the political aisle over the last year due to FBI investigations into Clinton’s use of a private email server and the Trump campaign’s ties to Russian political interests.

The White House and Trump administration strategy in justifying the firing “will absolutely [include] hammer[ing] away at the [point] that Democrats were calling for Jim Comey’s head for months,” a White House official told The Daily Beast. On Tuesday, Michael Short, a White House spokesman, tweeted a quote of Senate Minority Leader Chuck Schumer saying in late 2016 that “I do not have confidence in [James Comey] any longer.” Short also retweeted a March 2 tweet from former Clinton campaign manager Robby Mook stating that “It’s time for Comey to remove himself from this too. His credibility is gone.”

“As you and I have discussed… I cannot defend the Director’s handling of the conclusion of the investigation of Secretary Clinton’s emails… Almost everyone agrees that the director made serious mistakes; it is one of the few issues that unites people of diverse perspectives,” Rosenstein wrote in a memo to Sessions recommending Comey’s removal.

“As a result, the FBI is unlikely to regain public and congressional trust until it has a director who understands the gravity of the mistakes and pledges never to repeat them. Having refused to admit his errors, [Comey] cannot be expected to implement the necessary corrective actions,” he added.

But Rosenstein and his boss, Jeff Sessions, seem to have made their determination about Comey’s handling of the Clinton investigation before the department’s own inspector general apparently finished investigating Comey for the same matter. Inspector General Michael Horowitz said in January his office was investigating Comey’s handling of the Clinton investigation, including the July 2016 news conference that Rosenstein cites as the primary reason he was fired.

Trump cited Rosenstein’s memo in his statement on the firing, but did not mention Comey by name. “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 president said in the White House’s statement.

In a letter informing Comey of his removal, Trump told him, “It is essential that we find new leadership for the FBI that restores public trust and confidence in its vital law enforcement mission.”

He also alluded directly to the FBI’s investigation into his campaign. “While I greatly appreciate you informing me, on three separate 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.”

Attorney General Sessions, whom the White House credited with advising Comey’s removal, recused himself in March from the investigation into Trump’s campaign due to his role as a campaign surrogate.

Democrats involved in parallel congressional investigations into the Trump campaign’s Russia ties quickly painted Comey’s removal as political interference in an ongoing investigation.

It “raises profound questions about whether the White House is brazenly interfering in a criminal matter,” Rep. Adam Schiff, the House Intelligence Committee’s ranking Democrat, said in a statement. “[T]o take this action without addressing the profound conflict of interest of the President and Attorney General harkens back to a similarly tainted decision by President Nixon.”

Former FBI special agent Clint Watts echoed that sentiment. “I don’t think this is rule of law. This is rule by Trump,” he told The Daily Beast. It “reminds me of when Trump said, ‘I can shoot someone in the face and nothing will happen to me.’… [Trump] doesn’t like anybody who’s independent. I think it made him nervous that he couldn’t get Comey under his wing.”

Even some Republicans sounded suspicious. Though the case for Comey’s removal “was thorough, his removal at this particular time will raise questions,” said Sen. Bob Corker, chairman of the Foreign Relations Committee. He stressed the need for FBI investigative powers that are “fulsome and free of political interference.”

“Trump firing Comey shows how frightened the Admin is over Russia investigation,” Sen. Tim Kaine, Clinton’s 2016 running mate, wrote on Twitter. “Comey firing part of a growing pattern by White House to cover-up the truth.”

Brookings Institution senior fellow Benjamin Wittes, who has described Comey as “a personal friend,” said Trump’s decision to fire him would cast a shadow over the FBI’s investigation into the president’s campaign.

“It removes the one person of stature (figurative as well as literal) in the government whom everyone knows will—even when he’s wrong—do what he thinks is the right thing and damn the torpedos,” Wittes wrote on Tuesday evening. “It removes, in other words, the essential person for a credible investigation.”

The number two at the FBI, and Comey’s likely interim successor, is Deputy Director Andrew McCabe, who came under fire after a Clinton ally gave nearly half a million dollars to his wife’s election campaign. McCabe would then later go on to help oversee the investigation into Clinton’s email use.

McCabe may have also violated Justice Department rules, which bar contacts between the FBI and White House officials, when he spoke to the president’s chief of staff about the ongoing investigation into Russia’s efforts to subvert the U.S. elections.

But even that leadership change could be short-lived. Sources say McCabe will likely resign or be fired, though a well-wired federal law enforcement source told The Daily Beast that given current national security threats it's unlikely that would happen for the next few weeks.

Administration sources said McCabe has been eyed as a possible leaker of transcripts of calls between Flynn and Russia’s ambassador to Washington. The transcripts showed them discussing U.S. sanctions against the country and led to Flynn’s firing from the White House in February.

Multiple FBI and DOJ sources say the administration is convinced that a group of anti-Trump FBI officials are out to get the president. "DOJ could not control Comey… which was not going well" for Trump, one recently retired senior FBI official who worked with Comey told The Daily Beast.

The Clinton investigation surfaced again last week when Comey addressed aspects of it in his Judiciary Committee testimony. He incorrectly claimed during that hearing that former Clinton aide Huma Abedin had forwarded “hundreds to thousands” of emails to her husband Anthony Weiner’s computer, including messages that contained classified information.

The FBI was forced to walk back that assertion on Tuesday. It told committee chairman Sen. Chuck Grassley (PDF) that most of the emails discovered on Weiner’s computer during a separate investigation had been automatically backed up to that device, not forwarded by Abedin.

Some senators of both parties appeared to welcome the news in light of the recent turmoil involving the FBI in general and Comey in particular.

“Given the recent controversies surrounding the director, I believe a fresh start will serve the FBI and the nation well,” said Sen. Lindsey Graham. “I encourage the president to select the most qualified professional available who will serve our nation’s interests.”

Sen. Dianne Feinstein, the ranking Democrat on the Intelligence Committee, said the president had informed her of the move about 10 minutes before the announcement. “The next FBI director must be strong and independent and will receive a fair hearing in the Judiciary Committee,” she said.

—with additional reporting by Justin Miller and Jana Winter