Share story

WASHINGTON — The day before he upended the 2016 election, James B. Comey, the director of the Federal Bureau of Investigation, summoned agents and lawyers to his conference room. They had been debating all day, and it was time for a decision.

Comey’s plan was to tell Congress that the FBI had received new evidence and was reopening its investigation into Hillary Clinton, the presidential front-runner. The move would violate the policies of an agency that does not reveal its investigations or do anything that may influence an election. But Comey had declared the case closed, and he believed he was obligated to tell Congress that had changed.

“Should you consider what you’re about to do may help elect Donald Trump president?” an adviser asked him, Comey recalled recently at a closed meeting with FBI agents.

He could not let politics affect his decision, he replied. “If we ever start considering who might be affected, and in what way, by what we do, we’re done,” he told the agents.

But with polls showing Clinton holding a comfortable lead, Comey ended up plunging the FBI into the molten center of a bitter election. Fearing the backlash that would come if it were revealed after the election that the FBI had been investigating the next president and had kept it a secret, Comey sent a letter informing Congress that the case was reopened.

What he did not say was that the FBI was also investigating the campaign of Donald Trump. Just weeks before, Comey had declined to answer a question from Congress about whether there was such an investigation. Only in March, long after the election, did Comey confirm that there was one.

For Comey, keeping the FBI out of politics is such a preoccupation that he once said he would never play basketball with President Barack Obama because of the appearance of being chummy with the man who appointed him. But in the final months of the presidential campaign, the leader of the nation’s pre-eminent law enforcement agency shaped the contours, if not the outcome, of the presidential race by his handling of the Clinton and Trump-related investigations.

An examination by The New York Times, based on interviews with more than 30 current and former law enforcement, congressional and other government officials, found that while partisanship was not a factor in Comey’s approach to the two investigations, he handled them in starkly different ways. In the case of Clinton, he rewrote the script, partly based on the FBI’s expectation that she would win and fearing the bureau would be accused of helping her. In the case of Trump, he conducted the investigation by the book, with the FBI’s traditional secrecy. Many of the officials discussed the investigations on the condition of anonymity because they were not authorized to speak to reporters.

Comey made those decisions with the supreme self-confidence of a former prosecutor who, in a distinguished career, has cultivated a reputation for what supporters see as fierce independence, and detractors view as media-savvy arrogance.

The Times found that this go-it-alone strategy was shaped by his distrust of senior officials at the Justice Department, who he and other FBI officials felt had provided Clinton with political cover. The distrust extended to his boss, Loretta E. Lynch, the attorney general, who Comey believed had subtly helped play down the Clinton investigation.

His misgivings were only fueled by the discovery last year of a document written by a Democratic operative that seemed — at least in the eyes of Comey and his aides — to raise questions about her independence. In a bizarre example of how tangled the FBI investigations had become, the document had been stolen by Russian hackers.

The examination also showed that at one point, Obama himself was reluctant to disclose the suspected Russian influence in the election last summer, for fear his administration would be accused of meddling.

Comey, the highest-profile FBI director since J. Edgar Hoover, has not squarely addressed his decisions last year. He has touched on them only obliquely, asserting that the FBI is blind to partisan considerations. “We’re not considering whose ox will be gored by this action or that action, whose fortune will be helped,” he said at a public event recently. “We just don’t care. We can’t care. We only ask: ‘What are the facts? What is the law?’”

But circumstances and choices landed him in uncharted and perhaps unwanted territory, as he made what he thought were the least damaging choices from even less desirable alternatives.

“This was unique in the history of the FBI,” said Michael B. Steinbach, the former senior national security official at the FBI, who worked closely with Comey, describing the circumstances the agency faced last year while investigating both the Republican and Democratic candidates for president. “People say, ‘This has never been done before.’ Well, there never was a before. Or ‘That’s not normally how you do it.’ There wasn’t anything normal about this.”

‘Federal Bureau of Matters’

Comey owes his job and his reputation to the night in 2004 when he rushed to the Washington hospital room of John Ashcroft, the attorney general, and prevented Bush administration officials from persuading him to reauthorize a classified program that had been ruled unconstitutional. At the time, Comey, a Republican, was the deputy attorney general.

Years later, when Obama was looking for a new FBI director, Comey seemed an inspired bipartisan choice. But his style eventually grated on his bosses at the Justice Department.

In 2015, as prosecutors pushed for greater accountability for police misconduct, Comey embraced the controversial theory that scrutiny of police officers led to increases in crime — the so-called Ferguson effect.

“We were really caught off guard,” said Vanita Gupta, the Justice Department’s top civil rights prosecutor at the time. “He lobbed a fairly inflammatory statement, without data to back it up, and walked away.”

On other issues, Comey bucked the administration but won praise from his agents, who saw him as someone who did what he believed was right, regardless of the political ramifications.

“Jim sees his role as apolitical and independent,” said Daniel C. Richman, a longtime confidant and friend of Comey’s. “The FBI director, even as he reports to the attorney general, often has to stand apart from his boss.”

The FBI’s involvement with Clinton’s emails began in July 2015 when it received a letter from the inspector general for the intelligence community.

The letter said that classified information had been found on Clinton’s home email server, which she had used as secretary of state. The secret email setup was already proving to be a damaging issue in her presidential campaign.

Comey’s deputies quickly concluded that there was reasonable evidence that a crime may have occurred in the way classified materials were handled, and that the FBI had to investigate.

“We knew as an organization that we didn’t have a choice,” said John Giacalone, a former mob investigator who had risen to become the FBI’s top national security official.

On July 10, 2015, the FBI opened a criminal investigation, code-named “Midyear,” into Clinton’s handling of classified information. The Midyear team included two dozen investigators led by a senior analyst and by an experienced FBI supervisor, Peter Strzok, a former Army officer who had worked on some of the most secretive investigations in recent years involving Russian and Chinese espionage.

There was controversy almost immediately.

Responding to questions from The Times, the Justice Department confirmed that it had received a criminal referral — the first step toward a criminal investigation — over Clinton’s handling of classified information. But the next morning, the department revised its statement.

“The department has received a referral related to the potential compromise of classified information,” the new statement read. “It is not a criminal referral.”

At the FBI, this was a distinction without a difference: Despite what officials said in public, agents had been alerted to mishandled classified information and in response, records show, had opened a full criminal investigation.

The Justice Department knew a criminal investigation was underway, but officials said they were being technically accurate about the nature of the referral. Some at the FBI suspected that Democratic appointees were playing semantic games to help Clinton, who immediately seized on the statement to play down the issue. “It is not a criminal investigation,” she said, incorrectly. “It is a security review.”

In September of that year, as Comey prepared for his first public questions about the case at congressional hearings and press briefings, he went across the street to the Justice Department to meet with Lynch and her staff.

Both had been federal prosecutors in New York — Comey in the Manhattan limelight, Lynch in the lower-wattage Brooklyn office. The 6-foot-8 Comey commanded a room and the spotlight. Lynch, 5 feet tall, was known for being cautious and relentlessly on message. In her five months as attorney general, she had shown no sign of changing her style.

At the meeting, everyone agreed that Comey should not reveal details about the Clinton investigation. But Lynch told him to be even more circumspect: Do not even call it an investigation, she said, according to three people who attended the meeting. Call it a “matter.”

Lynch reasoned that the word “investigation” would raise other questions: What charges were being investigated? Who was the target? But most important, she believed that the department should stick by its policy of not confirming investigations.

It was a by-the-book decision. But Comey and other FBI officials regarded it as disingenuous in an investigation that was so widely known. And Comey was concerned that a Democratic attorney general was asking him to be misleading and line up his talking points with Clinton’s campaign, according to people who spoke with him afterward.

As the meeting broke up, George Z. Toscas, a national security prosecutor, ribbed Comey. “I guess you’re the Federal Bureau of Matters now,” Toscas said, according to two people who were there.

Despite his concerns, Comey avoided calling it an investigation. “I am confident we have the resources and the personnel assigned to the matter,” Comey told reporters days after the meeting.

The FBI investigation into Clinton’s email server was the biggest political story in the country in the fall of 2015. But something much bigger was happening in Washington. And nobody recognized it.

While agents were investigating Clinton, the Democratic National Committee’s computer system was compromised. It appeared to have been the work of Russian hackers.

The significance of this moment is obvious now, but it did not immediately cause alarm at the FBI or the Justice Department.

Over the previous year, dozens of think tanks, universities and political organizations associated with both parties had fallen prey to Russian spear phishing — emails that tricked victims into clicking on malicious links. The DNC intrusion was a concern, but no more than the others.

Months passed before the DNC and the FBI met to address the hacks. And it would take more than a year for the government to conclude that the Russian president, Vladimir Putin, had an audacious plan to steer the outcome of an American election.

Missing emails

Despite moments of tension between leaders of the FBI and the Justice Department, agents and prosecutors working on the case made progress. “The investigative team did a thorough job,” Giacalone said. “They left no stone unturned.”

They knew it would not be enough to prove that Clinton was sloppy or careless. To bring charges, they needed evidence that she knowingly received classified information or set up her server for that purpose.

That was especially important after a deal the Justice Department had made with David H. Petraeus, the retired general and former director of the Central Intelligence Agency. Petraeus had passed classified information to his biographer, with whom he was having an affair, and the evidence was damning: He revealed the names of covert agents and other secrets, he was recorded saying that he knew it was wrong, and he lied to the FBI.

But over Comey’s objections, the Justice Department let Petraeus plead guilty in April 2015 to a misdemeanor count of mishandling classified information. Charging Clinton with the same crime, without evidence of intent, would be difficult.

One nagging issue was that Clinton had deleted an unknown number of emails from her early months at the State Department — before she installed the home server. Agents believed that those emails, sent from a BlackBerry account, might be their best hope of assessing Clinton’s intentions when she moved to the server. If only they could find them.

In spring last year, Strzok, the counterintelligence supervisor, reported to Comey that Clinton had clearly been careless, but agents and prosecutors agreed that they had no proof of intent. Agents had not yet interviewed Clinton or her aides, but the outcome was coming into focus.

Nine months into the investigation, it became clear to Comey that Clinton was almost certainly not going to face charges. He quietly began work on talking points, toying with the notion that, in the midst of a bitter presidential campaign, a Justice Department led by Democrats may not have the credibility to close the case and that he alone should explain that decision to the public.

A suspicious document

A document obtained by the FBI reinforced that idea.

During Russia’s hacking campaign against the United States, intelligence agencies could peer, at times, into Russian networks and see what had been taken. Early last year, FBI agents received a batch of hacked documents, and one caught their attention.

The document, which has been described as both a memo and an email, was written by a Democratic operative who expressed confidence that Lynch would keep the Clinton investigation from going too far, according to several former officials familiar with the document.

Read one way, it was standard Washington political chatter. Read another way, it suggested that a political operative might have insight into Lynch’s thinking.

Normally, when the FBI recommends closing a case, the Justice Department agrees and nobody says anything. The consensus in both places was that the typical procedure would not suffice in this instance, but who would be the spokesman?

The document complicated that calculation, according to officials. If Lynch announced that the case was closed, and Russia leaked the document, Comey believed it would raise doubts about the independence of the investigation.

Comey sought advice from someone he has trusted for many years. He dispatched his deputy to meet with David Margolis, who had served at the Justice Department since the Johnson administration and who, at 76, was dubbed the Yoda of the department.

What exactly was said is not known. Margolis died of heart problems a few months later. But some time after that meeting, Comey began talking to his advisers about announcing the end of the Clinton investigation himself, according to a former official.

“When you looked at the totality of the situation, we were leaning toward: This is something that makes sense to be done alone,” said Steinbach, who would not confirm the existence of the Russian document.

Former Justice Department officials are deeply skeptical of this account. If Comey believed that Lynch were compromised, they say, why did he not seek her recusal? Comey never raised this issue with Lynch or the deputy attorney general, Sally Q. Yates, former officials said.

Comey’s defenders regard this as one of the untold stories of the Clinton investigation, one they say helps explain his decision-making. But former Justice Department officials say the FBI never uncovered evidence tying Lynch to the document’s author, and are convinced that Comey wanted an excuse to put himself in the spotlight.

As the Clinton investigation headed into its final months, there were two very different ideas about how the case would end. Lynch and her advisers thought a short statement would suffice, probably on behalf of both the Justice Department and the FBI.

Comey was making his own plans.

A hot tarmac

A chance encounter set those plans in motion.

In late June, Lynch’s plane touched down at Phoenix Sky Harbor International Airport as part of her nationwide tour of police departments. Former President Bill Clinton was also in Phoenix that day, leaving from the same tarmac.

Lynch’s staff loaded into vans, leaving the attorney general and her husband on board. Bill Clinton’s Secret Service agents mingled with her security team. When the former president learned who was on the plane, his aides say, he asked to say hello.

Bill Clinton’s aides say he intended only to greet Lynch as she disembarked. But Lynch later told colleagues that the message she received — relayed from one security team to another — was that he wanted to come aboard, and she agreed.

When Lynch’s staff members noticed the former president boarding the plane, a press aide hurriedly called the Justice Department’s communications director, Melanie Newman, who said to break up the meeting immediately. A staff member rushed to stop it, but by the time the conversation ended, Bill Clinton had been on the plane for about 20 minutes.

The meeting made the local news the next day and was soon the talk of Washington. Lynch said they had only exchanged pleasantries about golf and grandchildren, but Republicans called for her to recuse herself and appoint a special prosecutor.

Lynch said she would not step aside but would accept whatever career prosecutors and the FBI recommended on the Clinton case — something she had planned to do all along.

Comey never suggested that she recuse herself. But at that moment, he knew for sure that when there was something to say about the case, he alone would say it.

Calling a conference

Agents interviewed Hillary Clinton for more than 3 1/2 hours in Washington the next day, and the interview did not change the unanimous conclusion among agents and prosecutors that she should not be charged.

Two days later, on the morning of July 5, Comey called Lynch to say that he was about to hold a news conference. He did not tell her what he planned to say, and Lynch did not demand to know.

On short notice, the FBI summoned reporters to its headquarters for the briefing.

A few blocks away, Clinton was about to give a speech. At her campaign offices in Brooklyn, staff members hurried in front of televisions. And at the Justice Department and the FBI, prosecutors and agents watched anxiously.

“We were very much aware what was about to happen,” said Steinbach, who had taken over as the FBI’s top national security official earlier that year. “This was going to be hotly contested.”

With a black binder in hand, Comey walked into a large room on the ground floor of the FBI’s headquarters. Standing in front of two American flags and two royal-blue FBI flags, he read from a script.

He said the FBI had reviewed 30,000 emails and discovered 110 that contained classified information. He said computer hackers may have compromised Clinton’s emails. And he criticized the State Department’s lax security culture and Clinton directly.

“Any reasonable person in Secretary Clinton’s position” should have known better, Comey said. He called her “extremely careless.”

The criticism was so blistering that it sounded as if he were recommending criminal charges. Only in the final two minutes did Comey say that “no charges are appropriate in this case.”

The script had been edited and revised several times, former officials said. Strzok, Steinbach, lawyers and others debated every phrase. Speaking so openly about a closed case is rare, and the decision to do so was not unanimous, officials said. But the team ultimately agreed that there was an obligation to inform American voters.

“We didn’t want anyone to say, ‘If I just knew that, I wouldn’t have voted that way,’” Steinbach said. “You can argue that’s not the FBI’s job, but there was no playbook for this. This is somebody who’s going to be president of the United States.”

Comey’s criticism — his description of her carelessness — was the most controversial part of the speech. Agents and prosecutors have been reprimanded for injecting their legal conclusions with personal opinions. But those close to Comey say he has no regrets.

By scolding Clinton, Comey was speaking not only to voters but to his own agents. While they agreed that Clinton should not face charges, many viewed her conduct as inexcusable. Comey’s remarks made clear that the FBI did not approve.

Former agents and others close to Comey acknowledge that his reproach was also intended to insulate the FBI from Republican criticism that it was too lenient toward a Democrat.

At the Justice Department, frustrated prosecutors said Comey should have consulted with them first. Clinton’s supporters said that Comey’s condemnations seemed to make an oblique case for charging her, undermining the effect of his decision.

“He came up with a Rube Goldberg-type solution that caused him more problems than if he had just played it straight,” said Brian Fallon, the Clinton campaign press secretary and a former Justice Department spokesman.

Furious Republicans saw the legal cloud over Clinton lifting and tore into Comey.

In the days after the announcement, Comey and Lynch each testified before Congress, with different results. Neither the FBI nor the Justice Department normally gives Congress a fact-by-fact recounting of its investigations, and Lynch spent five hours avoiding doing so.

“I know that this is a frustrating exercise for you,” she told the House Judiciary Committee.

Comey discussed his decision to close the investigation and renewed his criticism of Clinton.

By midsummer, as Clinton was about to accept her party’s nomination for president, the FBI director had seemingly succeeded in everything he had set out to do. The investigation was over well before the election. He had explained his decision to the public.

And with both parties angry at him, he had proved yet again that he was willing to speak his mind, regardless of the blowback. He seemed to have safely piloted the FBI through the storm of a presidential election.

But as Comey moved past one tumultuous investigation, another was about to heat up.

Russia rising

Days after Comey’s news conference, Carter Page, an American businessman, gave a speech in Moscow criticizing U.S. foreign policy. Such a trip would typically be unremarkable, but Page had previously been under FBI scrutiny years earlier, as he was believed to have been marked for recruitment by Russian spies. And he was now a foreign policy adviser to Trump.

Page has not said whom he met during his July visit to Moscow, describing them as “mostly scholars.” But the FBI took notice. Page later traveled to Moscow again, raising new concerns among counterintelligence agents. A former senior U.S. intelligence official said that Page met with a suspected intelligence officer on one of those trips and there was information that the Russians were still very interested in recruiting him.

Later that month, the website WikiLeaks began releasing hacked emails from the DNC. Roger J. Stone Jr., another Trump adviser, boasted publicly about his contact with WikiLeaks and suggested he had inside knowledge about forthcoming leaks. And Trump himself fueled the FBI’s suspicions, showering Putin with praise and calling for more hacking of Clinton’s emails.

“Russia, if you’re listening,” he said, “I hope you’ll be able to find the 30,000 emails that are missing.”

In late July, the FBI opened an investigation into possible collusion between members of Trump’s campaign and Russian operatives. Besides Comey and a small team of agents, officials said, only a dozen or so people at the FBI knew about the investigation. Strzok, just days removed from the Clinton case, was selected to supervise it.

It was a worrisome time at the FBI. Agents saw increased activity by Russian intelligence officers in the United States, and a former senior U.S. intelligence official said there were attempts by Russian intelligence officers to talk to people involved in the campaign. Russian hackers had also been detected trying to break into voter registration systems, and intelligence intercepts indicated some sort of plan to interfere with the election.

In late August, Comey and his deputies were briefed on a provocative set of documents about purported dealings between shadowy Russian figures and Trump’s campaign. One report, filled with references to secret meetings, spoke ominously of Trump’s “compromising relationship with the Kremlin” and threats of “blackmail.”

The reports came from a former British intelligence agent named Christopher Steele, who was working as a private investigator hired by a firm working for a Trump opponent. He provided the documents to an FBI contact in Europe on the same day as Comey’s news conference about Clinton. It took weeks for this information to land with Strzok and his team.

Steele had been a covert agent for MI6 in Moscow, maintained deep ties with Russians and worked with the FBI, but his claims were largely unverified. It was increasingly clear at the FBI that Russia was trying to interfere with the election.

As the FBI plunged deeper into that investigation, Comey became convinced that the American public needed to understand the scope of the foreign interference and be “inoculated” against it.

He proposed writing an op-ed piece to appear in The Times or The Washington Post, and showed the White House a draft his staff had prepared, according to two former officials. (After this account was published online Saturday, a former White House official said that the text of the op-ed was not given to the White House.) The article did not mention the investigation of the Trump campaign, but it laid out how Russia was trying to undermine the vote.

The president replied that going public would play right into Russia’s hands by sowing doubts about the election’s legitimacy. Trump was already saying the system was “rigged,” and if the Obama administration accused Russia of interference, Republicans could accuse the White House of stoking national security fears to help Clinton.

Comey argued that he had unique credibility to call out the Russians and avoid that criticism. After all, he said, he had just chastised Clinton at his news conference.

The White House decided it would be odd for Comey to make such an accusation on his own, in a newspaper, before U.S. security agencies had produced a formal intelligence assessment. The op-ed idea was quashed. When the administration had something to say about Russia, it would do so in one voice, through the proper channels.

But John O. Brennan, the CIA director, was so concerned about the Russian threat that he gave an unusual private briefing in the late summer to Harry Reid, then the Senate Democratic leader.

Top congressional officials had already received briefings on Russia’s meddling, but the one for Reid appears to have gone further. In a public letter to Comey several weeks later, Reid said that “it has become clear that you possess explosive information about close ties and coordination between Donald Trump, his top advisers, and the Russian government — a foreign interest openly hostile to the United States.”

Comey knew the investigation of the Trump campaign was just underway, and keeping with policy, he said nothing about it.

‘Exceptional circumstances’

Reid’s letter sparked frenzied speculation about what the FBI was doing. At a congressional hearing in September, Rep. Jerrold Nadler, D-N.Y., pressed Comey for an explanation, citing his willingness to give details about his investigation of Clinton.

“After you investigated Secretary Clinton, you made a decision to explain publicly who you interviewed and why,” Nadler said. “You also disclosed documents, including those from those interviews. Why shouldn’t the American people have the same level of information about your investigation with those associated with Mr. Trump?”

But Comey never considered disclosing the case. Doing so, he believed, would have undermined an active investigation and cast public suspicion on people the FBI could not be sure were implicated.

“I’m not confirming that we’re investigating people associated with Mr. Trump,” Comey said to Nadler. “In the matter of the email investigation, it was our judgment — my judgment and the rest of the FBI’s judgment — that those were exceptional circumstances.”

Even in classified briefings with House and Senate intelligence committee members, Comey repeatedly declined to answer questions about whether there was an investigation of the Trump campaign.

To Comey’s allies, the two investigations were totally different. One was closed when he spoke about it. The other was continuing, highly classified and in its earliest stages. Much of the debate over Comey’s actions over the last seven months can be distilled into whether people make that same distinction.

Just a few weeks later, in late September, Steele, the former British agent, finally heard back from his contact at the FBI. It had been months, but the agency wanted to see the material he had collected “right away,” according to a person with knowledge of the conversation. What prompted this message remains unclear.

Steele met his FBI contact in Rome in early October, bringing a stack of new intelligence reports. One, dated Sept. 14, said that Putin was facing “fallout” over his apparent involvement in the DNC hack and was receiving “conflicting advice” on what to do.

The agent said that, if Steele could get solid corroboration of his reports, the FBI would pay him $50,000 for his efforts, according to two people familiar with the offer. Ultimately, he was not paid.

Around the same time, the FBI began examining a mysterious data connection between Alfa Bank, one of Russia’s biggest, and a Trump Organization email server. Some private computer scientists said it could represent a secret link between the Trump Organization and Moscow.

Agents concluded that the computer activity, while odd, probably did not represent a covert channel.

But by fall, the gravity of the Russian effort to affect the presidential election had become clear.

The DNC hack and others like it had once appeared to be standard Russian tactics to tarnish a Western democracy. After the WikiLeaks disclosures and subsequent leaks by a Russian group using the name DCLeaks, agents and analysts began to realize that Moscow was not just meddling. It was trying to tip the election away from Clinton and toward Trump.

Comey and other senior administration officials met twice in the White House Situation Room in early October to again discuss a public statement about Russian meddling. But the roles were reversed: Susan Rice, the national security adviser, wanted to move ahead. Comey was less interested in being involved.

At their second meeting, Comey argued that it would look too political for the FBI to comment so close to the election, according to several people in attendance. Officials in the room felt whiplashed. Two months earlier, Comey had been willing to put his name on a newspaper article; now he was refusing to sign on to an official assessment of the intelligence community.

Comey said that in the intervening time, Russian meddling had become the subject of news stories and a topic of national discussion. He felt it was no longer necessary for him to speak publicly about it. So when Jeh Johnson, the Homeland Security secretary, and James R. Clapper Jr., the national intelligence director, accused “Russia’s senior-most officials” on Oct. 7 of a cyber operation to disrupt the election, the FBI was conspicuously silent.

That night, WikiLeaks began posting thousands of hacked emails from another source: the private email account of John D. Podesta, chairman of the Clinton campaign.

The emails included embarrassing messages between campaign staff members and excerpts from Clinton’s speeches to Wall Street. The disclosure further convinced the FBI that it had initially misread Russia’s intentions.

Two days later, Podesta heard from the FBI for the first time, he said in an interview.

“You may be aware that your emails have been hacked,” an agent told him.

Podesta laughed. The same agency that had so thoroughly investigated Clinton, he said, seemed painfully slow at responding to Russian hacking.

“Yes,” he answered. “I’m aware.”

Supplementing the record

The Daily Mail, a British tabloid, was first with the salacious story: Anthony D. Weiner, the former New York congressman, had exchanged sexually charged messages with a 15-year-old girl.

The article, appearing in late September, raised the possibility that Weiner had violated child pornography laws. Within days, prosecutors in Manhattan sought a search warrant for Weiner’s computer.

Even with his notoriety, this would have had little impact on national politics but for one coincidence. Weiner’s wife, Huma Abedin, was one of Clinton’s closest confidantes, and had used an email account on her server.

FBI agents in New York seized Weiner’s laptop in early October. The investigation was just one of many in the New York office and was not treated with great urgency, officials said. Further slowing the investigation, the FBI software used to catalog the computer files kept crashing.

Eventually, investigators realized that they had hundreds of thousands of emails, many of which belonged to Abedin and had been backed up to her husband’s computer.

Neither Comey nor Lynch was concerned. Agents had discovered devices before in the Clinton investigation (old cellphones, for example) that turned up no new evidence.

Then, agents in New York who were searching image files on Weiner’s computer discovered a State Department document containing the initials HRC — Hillary Rodham Clinton. They found messages linked to Clinton’s home server.

And they made another surprising discovery: evidence that some of the emails had moved through Clinton’s old BlackBerry server, the one she used before moving to her home server. If Clinton had intended to conceal something, agents had always believed, the evidence might be in those emails. But reading them would require another search warrant, essentially reopening the Clinton investigation.

The election was two weeks away.

Comey learned of the Clinton emails on the evening of Oct. 26 and gathered his team the next morning to discuss the development.

Seeking a new warrant was an easy decision. He had a thornier issue on his mind.

Back in July, he told Congress that the Clinton investigation was closed. What was his obligation, he asked, to acknowledge that this was no longer true?

It was a perilous idea. It would push the FBI back into the political arena, weeks after refusing to confirm the active investigation of the Trump campaign and declining to accuse Russia of hacking.

The question consumed hours of conference calls and meetings. Agents felt they had two options: Tell Congress about the search, which everyone acknowledged would create a political furor, or keep it quiet, which followed policy and tradition but carried its own risk, especially if the FBI found new evidence in the emails.

“In my mind at the time, Clinton is likely to win,” Steinbach said. “It’s pretty apparent. So what happens after the election, in November or December? How do we say to the American public: ‘Hey, we found some things that might be problematic. But we didn’t tell you about it before you voted’? The damage to our organization would have been irreparable.”

Conservative news outlets had already branded Comey a Clinton toady. That same week, the cover of National Review featured a story on “James Comey’s Dereliction,” and a cartoon of a hapless Comey shrugging as Clinton smashed her laptop with a sledgehammer.

Congressional Republicans were preparing for years of hearings during a Clinton presidency. If Comey became the subject of those hearings, FBI officials feared, it would hobble the agency and harm its reputation. “I don’t think the organization would have survived that,” Steinbach said.

The assumption was that the email review would take many weeks or months. “If we thought we could be done in a week,” Steinbach said, “we wouldn’t say anything.”

The spirited debate continued when Comey reassembled his team later that day. FBI lawyers raised concerns, former officials said. But in the end, Comey said he felt obligated to tell Congress.

“I went back and forth, changing my mind several times,” Steinbach recalled. “Ultimately, it was the right call.”

That afternoon, Comey’s chief of staff called the office of Yates, the deputy attorney general, and revealed the plan.

When Lynch was told, she was both stunned and confused. While the Justice Department’s rules on “election year sensitivities” do not expressly forbid making comments close to an election, administrations of both parties have interpreted them as a broad prohibition against anything that may influence a political outcome.

Lynch understood Comey’s predicament, but not his hurry. In a series of phone calls, her aides told Comey’s deputies that there was no need to tell Congress anything until agents knew what the emails contained.

Either Lynch or Yates could have ordered Comey not to send the letter, but their aides argued against it. If Lynch issued the order and Comey obeyed, she risked the same fate that Comey feared: accusations of political interference and favoritism by a Democratic attorney general. If Comey disregarded her order and sent the letter — a real possibility, her aides thought — it would be an act of insubordination that would force her to consider firing him, aggravating the situation.

So the debate ended at the staff level, with the Justice Department imploring the FBI to follow protocol and stay out of the campaign’s final days. Lynch never called Comey herself.

The next morning, Friday, Oct. 28, Comey wrote to Congress, “In connection with an unrelated case, the FBI has learned of the existence of emails that appear to be pertinent to the investigation.”

His letter became public within minutes. Rep. Jason Chaffetz, R-Utah, a leading antagonist of Clinton’s, jubilantly announced on Twitter, “Case reopened.”

‘This changes everything’

The Clinton team was outraged. Even at the FBI, agents who supported their high-profile director were stunned. They knew the letter would call into question the FBI’s political independence.

Trump immediately mentioned it on the campaign trail. “As you might have heard,” Trump told supporters in Maine, “earlier today, the FBI … “ The crowd interrupted with a roar. Everyone had heard.

Polls almost immediately showed Clinton’s support declining. Presidential races nearly always tighten in the final days, but some political scientists reported a measurable “Comey effect.”

“This changes everything,” Trump said.

Comey explained in an email to his agents that Congress needed to be notified. “It would be misleading to the American people were we not to supplement the record,” he wrote.

But many agents were not satisfied.

At the Justice Department, career prosecutors and political appointees privately criticized not only Comey for sending the letter but also Lynch and Yates for not stopping him. Many saw the letter as the logical result of years of not reining him in.

Comey told Congress that he had no idea how long the email review would take, but Lynch promised every resource needed to complete it before Election Day.

At the FBI, the Clinton investigative team was reassembled, and the Justice Department obtained a warrant to read emails to or from Clinton during her time at the State Department. As it turned out, only about 50,000 emails met those criteria, far fewer than anticipated, officials said, and the FBI had already seen many of them.

Comey was again under fire. Former Justice Department officials from both parties wrote a Washington Post op-ed piece titled “James Comey Is Damaging Our Democracy.”

At a Justice Department memorial for Margolis, organizers removed all the chairs from the stage, avoiding the awkward scene of Comey sitting beside some of his sharpest critics.

Jamie S. Gorelick, a deputy attorney general during the Clinton administration, eulogized Margolis for unfailingly following the rules, even when facing unpopular options. Audience members heard it as a veiled critique of both Comey and Lynch.

On Nov. 5, three days before Election Day, Strzok and his team had 3,000 emails left to review. That night, they ordered pizza and dug in. At about 2 a.m., Strzok wrote an email to Comey and scheduled it to send at 6 a.m. They were finished.

A few hours later, Strzok and his team were back in Comey’s conference room for a final briefing: Only about 3,000 emails had been potentially work-related. A dozen or so email chains contained classified information, but the FBI had already seen it.

And agents had found no emails from the BlackBerry server during the crucial period when Clinton was at the State Department.

Nothing had changed what Comey had said in July.

That conclusion was met with a mixture of relief and angst. Everyone at the meeting knew that the question would quickly turn to whether Comey’s letter had been necessary.

That afternoon, Comey sent a second letter to Congress. “Based on our review,” he wrote, “we have not changed our conclusions.”

Political consequences

Comey did not vote on Election Day, records show, the first time he skipped a national election, according to friends. But the director of the FBI was a central story line on every television station as Trump swept to an upset victory.

Many factors explained Trump’s success, but Clinton blamed just one. “Our analysis is that Comey’s letter — raising doubts that were groundless, baseless, proven to be — stopped our momentum,” she told donors a few days after the election. She pointed to polling data showing that late-deciding voters chose Trump in unusually large numbers.

Even many Democrats believe that this analysis ignores other factors, but at the FBI, the accusation stung. Agents are used to criticism and second-guessing. Rarely has the agency been accused of political favoritism or, worse, tipping an election.

For all the attention on Clinton’s emails, history is likely to see Russian influence as the more significant story of the 2016 election. Questions about Russian meddling and possible collusion have marred Trump’s first 100 days in the White House, cost him his national security adviser and triggered two congressional investigations. Despite Trump’s assertions that “Russia is fake news,” the White House has been unable to escape its shadow.

Comey has told friends that he has no regrets, about either the July news conference or the October letter or his handling of the Russia investigation. Confidants like Richman say he was constrained by circumstance while “navigating waters in which every move has political consequences.”

But officials and others close to him also acknowledge that Comey has been changed by the tumultuous year.

Early on Saturday, March 4, the president accused Obama on Twitter of illegally wiretapping Trump Tower in Manhattan. Comey believed the government should forcefully denounce that claim. But this time he took a different approach. He asked the Justice Department to correct the record. When officials there refused, Comey followed orders and said nothing publicly.

“Comey should say this on the record,” said Tommy Vietor, a National Security Council spokesman in the Obama administration. “He’s already shattered all norms about commenting on ongoing investigations.”

Richman sees no conflict, but rather “a consistent pattern of someone trying to act with independence and integrity, but within established channels.”

“His approach to the Russia investigation fits this pattern,” he added.

But perhaps the most telling sign that Comey may have had enough of being Washington’s Lone Ranger occurred last month before the House Intelligence Committee.

Early in the hearing, Comey acknowledged for the first time what had been widely reported: The FBI was investigating members of the Trump campaign for possible collusion with Russia.

Yet the independent-minded FBI director struck a collaborative tone. “I have been authorized by the Department of Justice to confirm,” he began, ushering in the next phase of his extraordinary moment in national politics.

Comey was still in the spotlight, but no longer alone.