U.S. President Donald Trump abruptly fired FBI director James Comey Tuesday, ousting the nation's top law enforcement official in the midst of an investigation by the agency into whether Trump's campaign had ties to Russia's election meddling.

In a letter to Comey, Trump said the firing was necessary to restore "public trust and confidence" in the FBI.

"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," Trump said in a statement.

Comey has come under intense scrutiny in recent months for his role in 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 election.

Trump made no mention of Comey's role in the Clinton investigation, which she has blamed in part for the election result that put him in the White House.

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.

Firing a rare step

The firing of an FBI director is exceedingly rare. Democrats slammed the move, comparing it to former president Richard Nixon's "Saturday Night Massacre" decision to fire the independent special prosecutor overseeing the Watergate investigation, prompting the resignations of the Justice Department's top two officials.

"This is Nixonian," Senator Bob Casey of Pennsylvania said on Twitter. "Outrageous," said Oregon Senator Ron Wyden, calling for Comey to immediately be summoned to testify to Congress about the status of the Trump-Russia investigation

Trump has ridiculed the FBI investigation, as well as concurrent congressional investigations, as a "hoax" and has denied that his campaign was involved in Russia's election meddling.

In his letter to Comey, the president asserted the FBI director had informed him "on three separate occasions that I am not under investigation."

The White House said the search for a new FBI director was beginning immediately.

Early Wednesday, Trump tweeted about his decision, saying when things calm down Republicans and Democrats "will thank me." 

Overstated email security issue

Tuesday's announcement came shortly after the FBI corrected a sentence in Comey's sworn testimony on Capitol Hill last week.

Comey told lawmakers that Huma Abedin, a top aide to Clinton, had sent "hundreds and thousands" of emails to her husband's laptop, including some with classified information.

On Tuesday, the FBI said in a two-page letter to 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 in both parties welcomed news of the dismissal, an indication of the broad concern in Washington surrounding Comey's tenure at the FBI.

"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 Russian interference in the 2016 presidential election.

A 'big mistake' by Trump, Democrat says

Senator Dianne Feinstein of California, the top Democrat on the judiciary committee, said Trump called her Tuesday afternoon to inform her of his decision.

"The next FBI director must be strong and independent and will receive a fair hearing in the judiciary committee," she said in a statement.

'Everyone will suspect coverup.' - Chuck Schumer, Senate minority leader

Senate minority leader Chuck Schumer had scathing words about the announcement.

At a news conference Tuesday evening, Schumer said he told Trump that he was making a "big mistake" by firing Comey.

Questioning the timing of the firing just as the investigation into alleged election tampering by Russia gets underway in earnest, Schumer said "everyone will suspect coverup" if there isn't an independent special investigation into Trump ties to Russia.

Senate intelligence committee chairman Richard Burr also said he was "troubled by the timing and reasoning of Director Comey's termination."

Comey, 56, was nominated by former U.S. president Barack Obama in 2013 to a 10-year term. That appointment does not ensure a director will serve the full 10 years, though Comey is only the second FBI chief to be fired.

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

Attorney General Jeff Sessions said Comey was fired from his post because the law enforcement agency needs a "fresh start."

Trump Comey

In the letter from Attorney General Jeff Sessions to Trump, Sessions says a 'fresh start is needed at the leadership of the FBI.' (Jon Elswick/Associated Press)

In a letter addressed to Trump and released by the White House, Sessions said the FBI director must be someone who follows "faithfully the rules and principles" of the Justice Department.

Sessions also said the individual must be someone who "sets the right example" for law enforcement officials and others in the department.

He did not go into detail in the one-page letter dated Tuesday in which he recommended to Trump that Comey be removed as FBI director.

McCain calls for special committee

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

The Arizona senator said he has long called for a special congressional committee to investigate the matter and said Trump's decision to remove Comey "only confirms the need and the urgency of such a committee."

McCain said he was disappointed in Trump's decision, calling Comey a man of honour and integrity who led the FBI well in extraordinary circumstances.

Republican Senator Bob Corker of Tennessee said Comey's dismissal "will raise questions" and said "it is essential that ongoing investigations are free of political interference until their completion."

Comey had support from an unexpected corner Tuesday. Whistleblower Edward Snowden spoke out against his firing. 

With files from CBC News and Reuters