The White House said the search for a new FBI director would begin immediately.

President Donald Trump on Tuesday dismissed James Comey as director of the Federal Bureau of Investigations (FBI), sparking criticism by Republicans and Democrats that the move could undermine the integrity of an ongoing agency probe into alleged Russian interference in the 2016 presidential election.

The president cited Mr. Comey’s handling of the Hillary Clinton email investigation as the reason behind his decision, but Democrats were quick to question the move. Senior lawmakers of both parties called for an independent prosecutor or a special Congressional committee to investigate Russian meddling and its possible links with Trump associates.

Mr. Comey, a Republican, was appointed by President Barack Obama in 2013, with a 10-year-tenure. Mr. Trump had earlier fired acting attorney general Sally Yates for refusing to defend his executive order that barred travel from several Muslim-majority countries and federal attorney for New York Southern District Preet Bharara after he refused to resign, unlike all other federal prosecutors, following a White House demand. President Bill Clinton fired FBI director William S. Sessions in 1993, and this is the second time the agency’s chief has been fired.

As the debate appeared to be turning against him, the President tried to push back with a series of tweets explaining his decision and personally targeting some of the critics on Wednesday morning. “Comey lost the confidence of almost everyone in Washington, Republican and Democrat alike. When things calm down, they will be thanking me!,” he said in one tweet. “The Democrats have said some of the worst things about James Comey, including the fact that he should be fired, but now they play so sad!” he said in another.

Mr. Comey’s conduct in recent months as he oversaw two politically sensitive investigations — against Hillary Clinton for unauthorised use of a private server as Secretary of State and on Russian attempts to influence the election allegedly to favour Mr. Trump in 2016 — has won him approval and disapproval from parties, as and when it suited them. For instance, Ms. Clinton said in her first interview after losing the election that Mr. Comey’s decision to reopen the server investigation after it was declared closed was one of the two main reasons for her defeat, while Mr. Trump, as a candidate, had praised his guts for doing so. On the other hand, Democrats cheered him for publicly refuting the sitting President’s claim that he was wiretapped by former President Barack Obama and stating that Russian’s interference was with the intention of defeating Ms. Clinton and by implication, to help Mr. Trump.

His eventful and controversial ride ended with a curious twist, as the Trump administration accused him of being unfair to Ms. Clinton, echoing a charge the Democrats have been making all through. “….I cannot defend the Director’s handling of the conclusion of the investigation of Secretary Clinton’s emails, and I do not understand his refusal to accept the nearly universal judgment that he was mistaken. Almost everyone agrees that the Director made serious mistakes; it is one of the few issues that unites people of diverse perspectives,” Deputy Attorney General, Rod J. Rosenstein wrote in a memorandum, making the case for Mr. Comey’s dismissal. Mr. Rosenstein went on to elaborate how Mr. Comey’s public statements regarding the Clinton investigation were unfair to her. His conduct was then praised by the then Senator and now Attorney General Jeff Sessions.

“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,” Mr. Trump wrote in the dismissal letter, hand-delivered by his personal body guard at the FBI headquarters. Mr. Comey learned of his sacking from TV, at an office of the agency in Los Angeles.

Though the sacking was based on a Democratic accusation, the President did not find any support from the opposition for this decision. “You are making a big mistake,” Senate Democratic leader Chuck Schumer recalled telling the President who called him on Tuesday. Calling for a special prosecutor to investigate Russian interference in polls, Mr. Schumer said: “Every American will rightly suspect that the decision to fire Director Comes was part of a cover-up.” Senior Republican Senator John McCain said he was “disappointed in the President’s decision,” calling for “for a special Congressional committee to investigate Russia’s interference in the 2016 election.”