(This story corrects reference to Russian ambassador in paragraph 10.)

U.S. President Donald Trump speaks to reporters after his meeting with Russian Foreign Minister Sergey Lavrov at the White House in Washington, U.S., May 10, 2017. REUTERS/Kevin Lamarque

WASHINGTON (Reuters) - The anger behind Donald Trump’s firing of FBI Director James Comey on Tuesday had been building for months, but a turning point came when Comey refused to preview for top Trump aides his planned testimony to a Senate panel, White House officials said.

Trump, Attorney General Jeff Sessions and deputy Attorney General Rod Rosenstein had wanted a heads-up from Comey about what he would say at a May 3 hearing about his handling of an investigation into former Democratic presidential candidate Hillary Clinton’s use of a private email server.

When Comey refused, Trump and his aides considered that an act of insubordination and it was one of the catalysts to Trump’s decision this week to fire the FBI director, the officials said.

“It gave the impression that he was no longer capable of carrying out his duties,” one official said. Previews of congressional testimony to superiors are generally considered courteous.

Comey, who testified for four hours before the Senate Judiciary Committee, said it made him feel “mildly nauseous” that his decision to make public his reopening of a probe into Clinton’s handling of classified information might have affected the outcome of the Nov. 8 presidential election. But he said he had no regrets and would make the same decision again.

Trump’s sudden firing of Comey shocked Washington and plunged Trump deeper into a controversy over his campaign’s alleged ties with Russia that has dogged the early days of his presidency.

Democrats accused the Republican president of firing Comey to try to undermine the FBI’s probe into Russia’s alleged efforts to meddle in the 2016 election and possible collusion with members of the Trump campaign, and demanded an independent investigation. Some of Trump’s fellow Republicans called his dismissal of Comey troubling.

The Trump administration said on Tuesday Comey was fired because of his handling of the Clinton email probe.

Before he axed Comey, Trump had publicly expressed frustration with the FBI and congressional probes into the Russia matter. Moscow has denied meddling in the election and the Trump administration denies allegations of collusion with Russia.

A former Trump adviser said Trump was also angry because Comey had never offered a public exoneration of Trump in the FBI probe into contacts between the Russian ambassador to Washington, Sergei Kislyak, and Trump campaign advisers last year.

According to this former adviser, Comey’s Senate testimony on the Clinton emails likely reinforced in Trump’s mind that “Comey was against him.”

“He regretted what he did to Hillary but not what he did to Trump,” the former Trump adviser said of Comey.

Clinton has said that the Comey decision to announce the renewed inquiry days before the election was a likely factor in her loss to Trump.

Aides said Trump moved quickly after receiving a recommendation on Monday to terminate Comey from Rosenstein, who began reviewing the situation at the FBI shortly after taking office two weeks ago.

Trump’s move was so sudden that his White House staff, accustomed to his impromptu style, was caught off guard. Stunned aides scrambled to put together a plan to explain what happened.

White House spokesman Sean Spicer ended up briefing reporters about the move in the dark on Tuesday night near a patch of bushes steps away from the West Wing.

Comey, who was in Los Angeles meeting with FBI employees on Tuesday and returned later to Washington, has made no public comment on his firing.

‘FIG LEAF’

Many questions remained about what caused Trump to move so quickly.

Two former senior Justice Department officials said it made little sense to fire Comey while the Justice Department Inspector General was still doing a review of the FBI’s handling of the Clinton email investigation.

“I take Rod (Rosenstein) at his word that be believed everything in that memo but he must know that it’s going to be used as a fig leaf to fire Comey,” one former official said.

U.S. Senator Dianne Feinstein, the top Democrat on the Senate Judiciary Committee, told reporters it was her “understanding” Comey had been seeking more resources for his investigation into the tangled Russia controversy.

White House spokeswoman Sarah Huckabee Sanders said Trump had pondered dumping Comey as soon as he took office on Jan. 20, but decided to stick with him.

Trump shrugged off the political firestorm he created with Comey’s dismissal as he met with former U.S. Secretary of State Henry Kissinger in the Oval Office on Wednesday.

Asked by reporters why he fired Comey, Trump said, “He wasn’t doing a good job, very simply. He wasn’t doing a good job.”