WASHINGTON -- U.S. President Donald Trump abruptly fired FBI Director James Comey Tuesday, dramatically ousting the nation's top law enforcement official in the midst of an FBI investigation into whether Trump's campaign had ties to Russia's meddling in the election that sent him to the White House.

In a letter to Comey, Trump said the firing was necessary to restore "public trust and confidence" in the FBI. Comey has come under intense scrutiny in recent months for his public comments on an investigation into Democrat Hillary Clinton's email practices, including a pair of letters he sent to Congress on the matter in the closing days of last year's campaign.

Trump made no mention of Comey's role in the Clinton investigation, which she has blamed in part for the election result. But in announcing the firing, the White House circulated a scathing memo, written by Deputy Attorney General Rod Rosenstein, criticizing Comey's handling of the Clinton probe, including the director's decision to hold a news conference announcing its findings and releasing "derogatory information" about Clinton.

Since Attorney General Jeff Sessions recused himself from the bureau's Trump-Russia probe, Rosenstein has been in charge.

This is only the second firing of an FBI director in history. President Bill Clinton dismissed William Sessions amid allegations of ethical lapses in 1993.

Comey, who was in Los Angeles to speak at an FBI recruiting event, boarded his plane and headed back to Washington instead.

Democrats slammed Trump's action, comparing it to President Richard Nixon's "Saturday Night Massacre" decision to fire the independent special prosecutor overseeing the Watergate investigation in 1973, which prompted the resignations of the Justice Department's top two officials.

"This is Nixonian," Sen. Bob Casey, D-Pa., declared on Twitter. "Outrageous," said Oregon Sen. Ron Wyden, calling for Comey to immediately be summoned to testify to Congress about the status of the Trump-Russia investigation. Rep. Adam Schiff of California, top Democrat on the House intelligence committee, said the White House was "brazenly interfering" in the probe.

Republican Sen. John McCain of Arizona said Congress must form a special committee to investigate Russia's interference in the election.

Democrats expressed deep skepticism about the stated reasons for Tuesday's firing, raising the prospect of a White House effort to stymie the investigations by the FBI and congressional panels.

Trump will now appoint Comey's successor. The White House said the search for a replacement was beginning immediately. Comey's deputy, Andrew McCabe, takes over in the interim.

Trump has ridiculed the investigations as a "hoax" and has denied that his campaign was involved in Russia's meddling. In his letter to Comey, he asserted that the FBI director had informed him "on three separate occasions that I am not under investigation."

Tuesday's stunning announcement came shortly after the FBI corrected aspects of Comey's sworn testimony on Capitol Hill last week. Comey told lawmakers that Huma Abedin, a top aide to Hillary Clinton, had sent "hundreds and thousands" of emails to her husband's laptop, including some with classified information.

On Tuesday, the FBI told the Senate Judiciary Committee that only "a small number" of the thousands of emails found on the laptop had been forwarded there while most had simply been backed up from electronic devices. Most of the email chains on the laptop containing classified information were not the result of forwarding, the FBI said.

Some lawmakers did welcome news of the dismissal.

"Given the recent controversies surrounding the director, I believe a fresh start will serve the FBI and the nation well," said Republican Lindsay Graham of South Carolina, chairman of a Senate Judiciary subcommittee investigating the Russian campaign interference.

Comey, 56, was nominated by President Barack Obama for the FBI post in 2013 to a 10-year term, though that appointment does not ensure a director will serve the full term.

Praised frequently by both parties for his independence and integrity, Comey has spent three decades in law enforcement.

But his prominent role in the 2016 presidential campaign raised questions about his judgment and impartiality. Though the FBI did not recommend charges against Clinton for mishandling classified information, Comey was blisteringly critical of her decision to use a personal email account and private internet server during her four years as secretary of state.

Comey strongly defended his decisions during the hearing last week. He said he was "mildly nauseous" at the thought of having swayed the election but also said he would do the same again.

Clinton has partially blamed her loss on Comey's disclosure to Congress less than two weeks before Election Day that the email investigation would be revisited. Comey later said the FBI, again, had found no reason to bring any charges.

Trump disagreed with Clinton's assessment, tweeting that Comey actually "was the best thing that ever happened to Hillary Clinton in that he gave her a free pass for many bad deeds!"

Clinton's advisers were stunned by Trump's decision Tuesday. Former campaign spokesman Brian Fallon said that while he believed Comey had "inflicted severe damage" on the FBI, "the timing and manner of this firing suggest that it is the product of Donald Trump feeling the heat on the ongoing Russia investigation and not a well thought out response to the inappropriate handling of the Clinton investigation."

Though Comey was well-liked within the bureau, his independent streak occasionally rankled the Obama administration, including his repeated contention that a spike in violent crime might be linked to police officer anxiety over public scrutiny.

Before the past months' controversies, Comey, a former deputy attorney general in the George W. Bush administration, was perhaps best known for a remarkable 2004 standoff with top officials over a federal domestic surveillance program.

In March of that year, Comey rushed to the hospital bed of Attorney General John Ashcroft to physically stop White House officials in their bid to get his ailing boss to reauthorize a secret no-warrant wiretapping program.

Comey described the incident in 2007 testimony to Congress, explaining that he believed the spy program put in place after the Sept. 11, 2001, terror attacks was legally questionable.

When he learned that Andrew Card, the president's chief of staff, and Alberto Gonzales, the White House counsel, were heading to Ashcroft's hospital room despite Ashcroft's wife's instructions that there be no visitors, Comey told Congress, Comey beat them there and watched as Ashcroft turned them away.

"That night was probably the most difficult night of my professional life," Comey said.

------

AP writers Darlene Superville, Ken Thomas, Vivian Salama, Catherine Lucey and Sadie Gurman contributed to this report.