US President Donald Trump has fired FBI director James Comey, citing his handling of the investigation into Hillary Clinton's email server.

The sudden news, announced via a White House press release, shocked lawmakers, political pundits and the legal community.

"This is big news. Big news," said Stephen Ryan, a partner at McDermott Will & Emery and a former federal prosecutor in Washington. "I don't think he had the confidence of the American public anymore. In truth, it was probably time for him to go, although this is quite abrupt and interesting in itself."

Dechert partner David Kelley, Comey's successor as US attorney for the Southern District of New York, said simply in an email: "The canary in the mine has died."

A memo from Deputy Attorney General Rod Rosenstein said Comey was "wrong to usurp" the attorney general's authority last July when he announced the closure of the agency's Clinton investigation. Rosenstein's letter to Attorney General Jeff Sessions also said Comey "ignored another longstanding principle" by holding a press conference to "release derogatory information" about Clinton.

"The director laid out his version of the facts for the news media as if it were a closing argument, but without a trial," Rosenstein wrote. "It is a textbook example of what federal prosecutors and agents are taught not to do."

The letter further criticised Comey's decision in October, shortly before the election, to tell Congress that the investigation had been reopened to search more emails. Rosenstein's memo quoted criticism of Comey – tied to his handling of the Clinton emails investigation – from former top Justice Department officials including Jamie Gorelick and Larry Thompson.

Following Comey's termination, Andrew McCabe, his deputy, became acting FBI director. "Some people ask me whether I walked away from my law degree when I came into law enforcement, but it couldn't be further from the truth," McCabe said in April.

Ryan said picking the next director will be "absolutely critical". He suggested a pick from the judiciary or a career prosecutor, someone "who's neither red or blue".

"Anyone with a partisan political career is not appropriate," Ryan said.

Liberal advocacy groups and Democrats urged further scrutiny of Comey's termination. New York Attorney General Eric Schneiderman said the firing threatened "both critical investigations now underway, and the integrity and independence of the FBI".

The 10-year terms of FBI directors "were purposefully structured to span across sitting presidents to ensure the FBI's independence and insulate the bureau from partisan politics," said Anthony Romero, the American Civil Liberties Union executive director, in a statement.

"President Trump's dismissal of Comey raises questions about the administration's inappropriate meddling in bureau operations – precisely at a time when the bureau appears to be investigating the president, his advisers, and his campaign for potential collusion with Russian agents in our last election."

Comey, a former deputy attorney general who left the Justice Department in 2005, joined Lockheed Martin as senior vice-president and general counsel. "I have the best general counsel's job in America and I didn't have to move to Chicago to get it," Comey once remarked.

He had been general counsel to hedge fund Bridgewater Associates in Connecticut before his nomination to lead the FBI. In March 2013, Comey was appointed to the board of HSBC Holdings.

Comey's actions may weigh heavy on his future employment prospects, as big law firms may be wary of questions that would accompany his hiring. Still, as a prominent lawyer with high-level experience in government and business, he may find a home at a law firm, as some other former FBI directors have.

Robert Mueller, who left the FBI in 2013, joined Wilmer Cutler Pickering Hale and Dorr in Washington a year later; while Louis Freeh, who was the FBI director from September 1993 to May 2001, later founded US law firm Freeh Sporkin & Sullivan.

Andrew Denney in New York and Mike Scarcella in Washington contributed to this report.