For weeks, President Donald Trump had been seething.
The swirling questions about possible contacts between his presidential campaign team and Russia just wouldn't stop, and he felt it was overshadowing his early achievements.
Who was to blame? In Trump's view, FBI Director James Comey.
Comey had allowed the bureau's investigation to play out in the press, the president told those close to him, and hadn't done enough to stop leaks about it.
U.S. & World
Stories that affect your life across the U.S. and around the world.
Those simmering frustrations, described by people with knowledge of the president's conversations, culminated with Trump's surprise announcement late Tuesday that he was firing Comey. The people recounting the behind-the-scenes activity spoke only on condition of anonymity to disclose private discussions.
White House officials offered a somewhat different version Wednesday of how Trump came to fire Comey, casting his decision as one that reflected an "erosion of confidence" that had long been in the making.
"Frankly, he'd been considering letting Director Comey go since the day he was elected," said White House spokeswoman Sarah Sanders. She also expressed the White House hope that the Russia investigation would wrap soon. "We'd love for that to be completed so that we can all move on."
Reacting to 'Mildly Nauseous' Comment
But for weeks, the Russia investigation has not appeared to be going away.
Comey confirmed in March that the FBI was looking into possible coordination between the Russians and Trump associates. As Trump's presidency hit its 100-day mark, reporters were still asking questions.
Just last week, Comey answered more questions about it at hearing before the Senate Judiciary Committee. That testimony — during which Comey noted he felt "mildly nauseous" at the thought that his actions in the Hillary Clinton email case influenced the election — made Trump increasingly convinced he wanted Comey gone, according to a White House official.
That's around the time Comey was asking the Justice Department for more resources to pour into the Russia investigation — an indication the questions will be continuing.
The embattled top lawman told lawmakers he made the request for more help in a meeting with Rod Rosenstein, the deputy attorney general overseeing the Russia probe, according to three U.S. officials. The Justice Department denies there was such a request.
The White House would not say whether Trump knew.
Warnings About Comey
Some allies had been warning Trump since before his inauguration to get rid of Comey, describing him as a Republican who would criticize and do in fellow Republicans, according to one Trump associate.
But a final straw, said Sanders, landed in a Monday meeting among the president, Attorney General Jeff Sessions and Rosenstein, in which the two Justice officials expressed deep concern about Comey's leadership.
They had been at the White House on other business when Trump called them in to talk about Comey and asked, "So what do you think?" according to a senior White House official.
The president got an earful, according to Sanders, and told them to put their concerns in writing.
Rosenstein answered with a three-page memo that amounted to a scathing takedown of the FBI director, calling his 2016 disclosures about the bureau's investigation into Hillary Clinton's use of a personal email server a "textbook example of what federal prosecutors and agents are taught not to do."
Trump Tells Congress
Around 5 p.m. Tuesday, Trump called a number of legislators, including Democratic Sen. Chuck Schumer, a fellow New Yorker, to relay the stunning news that he was firing Comey.
"With all due respect, you're making a big mistake," Schumer told Trump.
The president was taken aback, according to a person with knowledge of the call. Apparently the White House had expected Democrats to largely welcome the decision, given their outrage over Comey's handling of the Clinton email investigation.
Democrats, though, and even some Republicans are openly skeptical of the notion that Trump decided to fire Comey because of how he'd treated Clinton. They note that Trump last October had publicly praised Comey for having the "guts" to raise new questions late in the campaign about Clinton's email situation.
As recently as last week, the White House had said Comey had Trump's confidence.
Comey Finds Out
As for Comey, he was speaking to agents at the FBI's field office in Los Angeles when news of his firing broke.
The White House had a Trump bodyguard deliver a copy of Trump's dismissal letter to the Justice Department and sent Comey an email as well, according to a senior administration official. But it's unclear whether Comey got the word before his ouster was publicly announced.
Television screens in the Los Angeles field office began flashing the news as he spoke, and he initially chuckled. He continued his speech to the agents, finished and headed into an office, according to a law enforcement official who was present.
As commentators on cable TV called Trump's move an abuse of power, the president was startled and infuriated by how his action was being received, according to a person with knowledge of his reaction.
The White House also did not appear to be prepared for the firestorm. Aides scrambled to rush out a statement on Comey's firing. But the White House's email system was running slowly. Journalists raced to Press Secretary Sean Spicer's office to confirm the news, prompting him to read the statement out loud before disappearing into his office.
Initial reaction from lawmakers was muted, and the White House appeared inclined to let the day finish without sending the president or top aides on television.
But as the response grew more critical, Trump ordered his press staff to get out and defend him.
A trio of senior aides, including Spicer, hastily headed out for TV interviews on the North Lawn of the White House.
That chore completed, Spicer still had to deal with a horde of other reporters. He took a step out of the White House hedges, where he had been waiting after finishing a TV interview, and demanded that the cameras and their lights be turned off.
At the end of a long day, only the dim lights from reporters' cellphones lit the scene as the White House press secretary spoke, largely in the dark.
Associated Press writers Julie Pace, Vivian Salama, Ken Thomas, Eric Tucker and Catherine Lucey contributed to this report.