In a letter to members of staff he said “working with them had been one of the great joys of my life”.
He added: “I have long believed that a president can fire an FBI director for any reason, or for no reason at all.
“I’m not going to spend time on the decision or the way it was executed. I hope you won’t either.
“It is done and I will be fine, although I will miss you and the mission deeply.”
He said: “My hope is that you will continue to live our values and the mission of protecting the American people and upholding the Constitution.
“If you do that, you too will be sad when you leave, and the American people will be safer.”
Meanwhile, the acting director of the FBI, Andrew McCabe, will testify on Capitol Hill later, as a witness at a Senate Intelligence Committee hearing alongside the Director of National Intelligence Dan Coats, CIA director Mike Pompeo and National Security Agency chief Mike Rogers.
He has also assumed responsibility for the FBI’s investigation into ties between Donald Trump’s 2016 presidential campaign and Russia until an interim director is installed.
Mr Comey was fired, the White House says, after the president and the Department of Justice lost faith in him over his handling of the investigation into Hillary Clinton’s email server last year. Mr Trump told reporters that Mr Comey was fired because “he wasn’t doing a good job, very simply”.
But Democrats have accused the White House of firing Mr Comey over the Trump-Russia investigation and have demanded the appointment of a special prosecutor.
Senator Chuck Schumer said: “We know Director Comey was leading an investigation into whether the Trump administration colluded with the Russians, a serious offence. Were those investigations getting too close to home for the president?”
White House spokeswoman Sarah Huckabee Sanders dismissed calls for further investigations: “We don’t think it is necessary.
“Any investigation happening on Monday is happening today. We encourage them to complete that investigation so we can put it behind us.”
All of this happened on the day that Mr Trump met the Russian foreign minister at the White House. Sergei Lavrov had earlier joked with the press corps that he had not heard of Mr Comey’s firing.
A photo of Mr Trump’s meeting Mr Lavrov appeared on Russian state media after the US press pool were excluded from the event.
The Russian president has also again dismissed claims of his country’s involvement in US elections.
Mr Trump did appear before the cameras at a White House event alongside Henry Kissinger, who was national security adviser to president Richard Nixon. The 37th president was forced to resign over the Watergate scandal.
Some Democrats have called Mr Trump’s behaviour ‘Nixonian’ and compared his firing of Mr Comey to Nixon’s infamous ‘Saturday Night Massacre’.
Political historian Allan Lichtman, who has written a book predicting Mr Trump’s impeachment, said: “There are chilly parallels between Nixon’s Saturday Night Massacre and Trump’s Tuesday night massacre.
“In both cases they were brazen attempts to cover up investigations that were getting uncomfortably close to the truth.
“Nixon’s Saturday Night Massacre failed and so too will Trump’s and will likely lead to his impeachment.”