WASHINGTON – The FBI’s handling of the Hillary Clinton email investigation has created more turmoil for the bureau than any other matter in recent history, exposing internal tensions with the Justice Department and stirring concerns the famously apolitical organization unnecessarily injected itself into the campaign.

The FBI for decades has prided itself on being both independent and silent about its work. It has survived other painful moments in its century-long existence. But rarely have its core duties become so awkwardly entangled with politics, thanks to an election-year criminal investigation involving Clinton’s email practices – and whiplash-producing public statements in the final two weeks of the campaign.

Though FBI Director James Comey signalled a conclusion to the Clinton email matter with a letter to Congress on Sunday, the public isn’t done discussing it: Lawmakers demand answers to questions left unresolved by two vague and ambiguous letters. Clinton and her aides feel wronged by a curiously timed disclosure. And ex-prosecutors of both parties are concerned the bureau’s actions strayed from its mandate to remain above politics.

The controversy, coupled with a series of leaks laying bare internal squabbling, suggests a tough road ahead for FBI leadership regardless of who wins Sunday. “This has been a very difficult election process. Unfortunately, the FBI has been drawn into it,” said Leo Taddeo, a retired FBI supervisor. He said he was concerned that candidates seemed more eager than before to politicize national security issues and seek investigations into opponents.

“This is a new and developing trend in U.S. political discourse, so I think the FBI has to resist being drawn into it,” he added.

That’s easier said than done.

The FBI last year began investigating Clinton for the potential mishandling of classified information as secretary of state after a referral from the intelligence community inspector general. Comey has said the investigation was done without regard to politics, but he also never lost sight of its political sensitivities, receiving regular briefings from investigators and repeatedly refusing to discuss it in public.

When the FBI decided it wouldn’t recommend charges, he broke from protocol and delivered an unusual public statement chastising Clinton and her aides as “extremely careless.”

But the pushback to that announcement was nothing compared to what Comey has faced the last two weeks, starting with his Oct. 28 notification to Congress that the FBI would review newly discovered emails potentially connected to the Clinton email investigation.

The statement provoked outrage from Clinton and other Democrats who said it needlessly placed her under suspicion when the FBI didn’t even know if the emails were important. The Justice Department opposed the idea, too.

Related: FBI director: No new charges from latest Hillary Clinton emails

Then came Sunday’s statement, in which Comey effectively cleared the Democratic presidential nominee by saying the new review had done nothing to change the FBI’s July recommendation that she not face charges. Though a relief to Democrats and Clinton, the news also infuriated some who wondered why the new emails – if apparently insignificant – were ever made public in the first place.

“Today’s letter makes Director Comey’s actions nine days ago even more troubling,” said Sen. Dianne Feinstein of California, the ranking Democrat on the Senate intelligence committee.

Comey says he felt obligated to alert Congress after having previously testified that the investigation had been closed. Supporters say had he kept silent until after the election, he would have faced partisan allegations of stifling a bombshell announcement and perhaps given fuel to allegations of a “rigged” election. He also would have risked the chance of the news leaking out anyway.

“Do I sit quietly and do nothing for 10 days and let the election quietly go by, pregnant with the knowledge that we have thousands of new emails?” said Ron Hosko, a retired FBI assistant director. “Or do I tell the same Congress that I’ve been committed to being transparent with?”

The bureau has been further roiled by leaks that hint at disagreement over the handling of a separate inquiry involving the Clinton Foundation. The Associated Press and other news organizations have reported that FBI agents seeking an investigation met earlier this year with public corruption prosecutors to present allegations they wanted to pursue, but that the lawyers did not see a basis for moving forward.

Hosko said there’s no doubt former agents in particular were distressed by the FBI’s decision not to recommend charges against Clinton. But he said there was no “revolution” inside the storied Hoover Building.

“There’s a lot of fiction-writing going on,” Hosko said. “It’s being fanned up by people and repeated by people who pretend they know something when they know nothing.”

The FBI has survived frayed relations between its leaders and the president before – Bill Clinton and his FBI director, Louis Freeh, were known to have strongly disliked each other. In the modern era, it’s gone through major structural reorganizations, such as after the Sept. 11 attacks, and faced second-guessing after operations that haven’t gone as planned.

But the latest turmoil poses a unique challenge for a revered law enforcement organization and for a director who talks often about his desire to be accountable to the American people – and transparent.

Depending on who wins Tuesday, Comey will have to co-exist with either a Republican president who has repeatedly challenged his agency’s integrity or a Democrat whose email practices were the subject of a criminal investigation. He’ll also probably have to explain his decision-making to Congress.

“Rest assured, Jim Comey’s not afraid of creating controversy,” Taddeo said. “He is determined to do the right thing.”