Washington (CNN) Among the casualties of the 2016 presidential campaign is the mystique of the FBI.

Behind the scenes over the past 15 months, infighting among some agents and officials has exposed some parts of the storied bureau to be buffeted by some of the same bitter divisions as the rest of American society.

This account is based on interviews with more than a dozen officials close to the matter who spoke anonymously because they've been ordered not to speak to the news media.

Tensions have built in particular over the handling of matters related to Hillary Clinton. Some of the sharpest divides have emerged between some agents in the FBI's New York field office, the bureau's largest and highest-profile, and officials at FBI headquarters in Washington and at the Justice Department.

Some rank-and-file agents interpreted cautious steps taken by the Justice Department and FBI headquarters as being done for political reasons or to protect a powerful political figure. At headquarters, some have viewed the actions and complaints of some agents in the field as driven by the common desire of investigators to get a big case or, perhaps worst, because of partisan views.

The tensions have multiplied since FBI Director James Comey made an unprecedented public announcement in July that there should be no charges against Clinton or her aides following a year-long probe.

That announcement -- without prior notice to his bosses at the Justice Department and, according to his critics, usurping the traditional role of prosecutors to review FBI recommendations in secret -- opened up sharp divides between Justice and FBI officials, and even within the Justice Department itself, where some officials have pushed for Attorney General Loretta Lynch to more forcefully assert her power over the FBI.

President Barack Obama in an interview published Wednesday noted the efforts to not appear to interfere with the work of the FBI.

"I've made a very deliberate effort to make sure that I don't look like I am meddling in what are supposed to be independent processes for making these assessments," he told NowThisNews.

An independent agency

Some of the tensions are built-in because of the FBI's unique position as part of the Justice Department but also projecting a large measure of independence. The FBI director's job has a 10-year tenure, spanning presidential administrations, while his bosses at the Justice Department are politically appointed and they leave when the administration ends. Comey, in public speeches, often mentions reminders of abuses in the FBI's past under J. Edgar Hoover, who secretly kept files on lawmakers and presidents.

One official said the FBI is "resolute and confident that what we're doing -- though not palatable -- is the right thing and we are maintaining independence."

Much of the turmoil centers not only on the handling of the probe into Clinton's use of a private server while secretary of state, but also another case some FBI agents wanted to pursue into the Clinton Foundation and whether there was any impropriety in dealings with donors.

JUST WATCHED Obama on FBI: We don't operate on innuendo Replay More Videos ... MUST WATCH Obama on FBI: We don't operate on innuendo 02:04

In both cases, some FBI investigators felt stymied by headquarters and Justice Department officials and they interpreted roadblocks as politically partisan.

It's in that tense environment that the latest developments emerged as agents were conducting the unrelated investigation of Anthony Weiner, the disgraced former congressman and estranged husband of Clinton's close adviser Huma Abedin.

The surprise discovery of thousands of emails belonging to Abedin on a computer belonging to Weiner brought matters to a boil.

The longer it took for officials at FBI headquarters and at the Justice Department to decide how to proceed with the matter, the more conspiracies spread among some agents that perhaps senior FBI officials were trying to cover up the matter.

Comey on Friday sent a letter to committee leaders in Congress with oversight of the FBI alerting them of the recently discovered documents and resulting investigation.

He acted in part, people close to him say, because he believed the news would eventually leak and the bureau would face an even bigger public backlash.

"It's the times we are living in," one senior law enforcement official said. "No one has emerged from this election unscathed."

The election may soon be over, but the impact on the FBI will take some time to assess.

'Politics is running rampant'

Veterans of the bureau think the controversy is a symptom of the bitter election year.

"Politics is running rampant," says former FBI Boston chief Rick DesLauriers, who oversaw the investigation into the Boston Marathon bombings. "Passions are high."

DesLauriers believes Comey has tried to ensure decisions are based on principle, not politics.

JUST WATCHED FBI tweets old files on the Clintons and Trump's dad Replay More Videos ... MUST WATCH FBI tweets old files on the Clintons and Trump's dad 04:57

"He made a decision that angered Republicans in July and one that angered Democrats in October," said DesLauriers, who retired three years ago. "That's a pretty good indication he's nonpartisan."

To be sure, differences of opinion between FBI field offices and headquarters are a common occurrence on any number of cases. The hard-charging New York field office is often tussling with headquarters over management of cases, officials say.

But the Clinton probes are no ordinary cases.

"The FBI is an organization not comfortable operating in a political environment," another official said. "The intent was not to enter the political fray."

Soon after the FBI opened its investigation into the Clinton server in the summer of 2015, Comey decided it would be run from headquarters instead of New York, which is the jurisdiction where the Clinton server had been located.

That decision angered some in New York who thought it was headquarters' interference into their case.

Given the sensitivity of the case, Comey brought in a team of agents mostly from the Washington, D.C., field office, to pore through the thousands of emails.

He assigned the case to the counterintelligence section, which investigates cases of alleged mishandling of classified information. It gave the added advantage of being a section with a reputation for few media leaks and being close enough for Comey to get personal almost-daily updates.

"We're in the middle of one of the most vitriolic campaigns in American history, and we're investigating one of the candidates for president," the senior law enforcement official said. "We had to get this right."

JUST WATCHED Clinton campaign cries foul on FBI Replay More Videos ... MUST WATCH Clinton campaign cries foul on FBI 02:41

That didn't quiet all of the complaints, particularly now that the behind-the-scenes tussles are spilling out into the public.

During the Clinton email server investigation, investigators and prosecutors debated whether to issue subpoenas to Clinton's aides, officials say. Leaders at the FBI and at the Justice Department thought it would be faster to come to voluntary agreements with aides. Subpoenas could cause delays, particularly if litigation is necessary, officials said. And the FBI and Justice Department wanted to try to complete the probe and get out of the way of the 2016 election.

Clinton Foundation in focus

The tensions built after agents in several field offices began looking into allegations of corruption related to the Clinton Foundation, the charity of Bill and Hillary Clinton and their daughter, Chelsea. The FBI, under long-standing policy, hasn't publicly acknowledged the existence of the investigation.

Some of the allegations made headlines with the May 2015 publication of the book "Clinton Cash" by conservative writer Peter Schweizer, alleging corrupt ties between the Clinton Foundation and big-money foreign donors.

It's not uncommon for FBI probes to begin as a result of or be fueled by published news articles or books.

Similar probes have been underway for well over a year into people associated with Donald Trump's campaign. These include a probe of Trump's former campaign chairman, Paul Manafort, and his ties to pro-Russian figures in Ukraine. The Trump-related probes, none of which have been officially acknowledged by the FBI, also were slowed in recent months because of Justice Department rules not to conduct overt steps that could affect the election. But officials say the cases were ongoing for well over a year before the election concerns became an issue.

JUST WATCHED FBI probes into Trump-Russia ties yield little Replay More Videos ... MUST WATCH FBI probes into Trump-Russia ties yield little 03:05

In the Clinton Foundation probe, at least one FBI field office also received notification of a possible suspicious bank transaction. The transaction involving a Clinton Foundation donor was flagged in what is known as a suspicious activity report, routine notices sent through the Treasury Department's financial enforcement arm.

By early this year, FBI agents from four field offices -- Los Angeles, Little Rock, Arkansas, Washington, D.C., and New York -- had open files on the Clinton Foundation and were seeking to get permission to formally conduct investigations of the Clinton Foundation.

In February, as CNN first reported, FBI criminal division leaders and lawyers met with the lawyers from the Justice Department's public integrity section to present what was known so far and to seek permission to conduct full-blown investigations, including the ability to subpoena records.

At that time, the Justice officials in the meeting advised FBI officials that there wasn't sufficient evidence to move forward and declined to give the authorization for overt investigative techniques. Some officials described a contentious meeting with strong disagreement on both sides.

Officials leading the meeting told the FBI that investigators hadn't turned up much more evidence beyond that contained in "Clinton Cash."

FBI lawyers at headquarters concurred with the Justice Department's view that agents be allowed to continue their work with the option to return if they found more evidence.

In July, Comey made his announcement to recommend no charges against Clinton.

At a Capitol Hill hearing days later, Comey told members of Congress that he was proud there had been no leaks of his decision.

But blowback from some current and former agents was immediate. As Comey made his rounds of visits to field offices around the country, he heard stinging criticism, particularly from retired agents.

At one meeting in Kansas City, Comey was confronted with stinging criticism of the probe. He pushed back, saying the career agents who knew the most of the case arrived at the conclusion that the case against Clinton wasn't even a close call.

FBI agents again pressed to take more overt steps in the Clinton Foundation probe, including possibly issuing subpoenas.

Justice Department officials again opposed such moves. They cited, again, a lack of evidence to warrant more investigative steps. And they expressed concerns that with the election close, any overt actions shouldn't be made until after Election Day.

"It's just a (message of) 'hold right now until after the elections -- no subpoenas issued, no interviews," one law enforcement official familiar with the July decision said.

JUST WATCHED Robby Mook calls for fair treatment from the FBI Replay More Videos ... MUST WATCH Robby Mook calls for fair treatment from the FBI 00:57

Some FBI officials also viewed the existing cases in the four field offices to not have advanced much beyond the allegations in "Clinton Cash."

Officials at FBI headquarters decided the Clinton Foundation probe should be consolidated in New York. They ordered that agents in Los Angeles, Little Rock and Washington, D.C., turn over their files to the FBI New York office, which appeared to have the strongest case to make.

Agents were told to continue their work. But the order to the other field offices angered agents there.

In the Washington field office, a half-mile away from headquarters, agents were told they could continue to work on a probe of Virginia Gov. Terry McAuliffe, but would have to discontinue what they viewed as relevant connected work on the Clinton Foundation. McAuliffe is a close ally of the Clintons and previously headed the Clinton Foundation.

In New York, some agents working the Clinton Foundation case chafed at the decision that they had to sit and wait until after the election.

How will controversy shape the bureau?

Decades after the death of J. Edgar Hoover, who built the mystique of FBI agents as a special class of investigators, the bureau continues to nurture that image. The bureau lends its help to Hollywood, which churns out movies and television shows glamorizing the work of FBI agents.

In recent years, the bureau has sought to modernize, promoting more women to some higher ranks, and seeking to train new ranks of analysts alongside agents as a way to make clear that intelligence analysts should be treated as equals to gun-carrying agents. Struggles remain as Comey tries to change what is still an overwhelmingly white and male-dominated organization.

How much the recent controversy changes the FBI is to be seen.

James V. DeSarno, who spent 28 years in the bureau and rose to the level of assistant director, agrees that Comey's July announcement and Friday letter were unprecedented. But he says it doesn't signal how the FBI will run cases.

"I don't think he believes he's changed the rules," DeSarno said of Comey, "But I can see where other people may think he has."