James Comey, the 55-year-old director of the Federal Bureau of Investigation, came under heavy criticism on Friday after he sent a vaguely worded letter to congressional Republicans that appeared to suggest that the FBI would “reopen” its investigation into the use of a private email server by former secretary of state — now Democratic presidential candidate — Hillary Clinton.

Comey sent the letter with just 11 days remaining before the November 8 election.

With just two days to go before the national vote, Comey sent another letter to congress, saying that the FBI’s review of newly discovered emails on a computer owned by disgraced former congressional rep Anthony Weiner — estranged husband of Clinton’s longtime aide Huma Abedin — found nothing that warranted changes to the Bureau’s July decision against hitting Clinton with any charges.

In fact, according to one report, almost all of the new emails were simply duplicates of emails included in the FBI’s original inquiry.

NBC's Pete Williams reports that nearly all of the e-mails found on the Weiner laptop were duplicates of e-mails FBI already reviewed. — Tom Winter (@Tom_Winter) November 6, 2016

The second Comey letter, in effect an admission that he had thrown the presidential election into chaos for no reason, led to a new groundswell of calls for his firing.

I don't see any Ds praising Comey. I see renewed calls for him to resign or be fired. https://t.co/IohrYT0Kp3 — Markos Moulitsas (@markos) November 6, 2016

But can President Barack Obama, who appointed Comey to the job in 2013, or a hypothetical future President Hillary Clinton step in and fire Comey over what some are calling his attempt to interfere in the presidential election?

Here’s what you need to know.

1. Under the Law, Presidents May Fire FBI Directors

Under a United States statute that first went into effect in 1968, FBI directors are nominated by the president and must be confirmed by the Senate — a process similar to the nomination and confirmation of Supreme Court justices or presidential cabinet officials.

Unlike the justices, who are appointed for life and cannot be fired — but can be impeached by congress (which has happened only one time in American history) — or cabinet officials who have no set terms, the FBI director is appointed to a single term of 10 years.

The statute establishing the 10-year term limit was passed in 1976, four years after the death of legendary FBI director J. Edgar Hoover, who held on to the job for 48 years.

But according to a 2014 report by the Congressional Research Service, “there are no statutory conditions on the President’s authority to remove the FBI Director.” In other words, the President can indeed fire the FBI director. An FBI director can also be removed by congress, through the impeachment process.

2. Only One FBI Director Has Ever Been Fired

Not every FBI director since Hoover has served out his (they have all been men) 10-year term. Hoover’s successor Clarence Kelley retired in 1978, at the age of 67. Louis Freeh, who had been appointed by President Bill Clinton in 1993, resigned in 2001 in the aftermath of the Robert Hanssen spy scandal in which a former FBI agent, Hanssen, was unmasked as a Russian agent.

But only one of those directors was ever fired by a president — William S. Sessions who had been appointed by President Ronald Reagan in 1987, but who was beset by allegations of ethics violations , such as disguising private vacations as law enforcement business, and using a chauffeured government limousine for personal transportation.

Because firing an FBI director is certain to bring accusations of playing politics with law enforcement against any president who chooses to do so, Clinton repeatedly asked Sessions to resign his post. But Sessions refused to step down.

So in July of 1993, saying that he had been advised by then-attorney general Janet Reno that Sessions “can no longer effectively lead the bureau and law enforcement community,” Clinton fired the FBI director — eventually appointing Freeh in his place.

3. Comey Defied Justice Department Rules — And Possibly Broke the Law

On Sunday, Senate Democratic Leader Harry Reid sent his own letter — to Comey. In the letter, Reid told the FBI director, “my office has determined that these actions may violate the Hatch Act. Through your partisan actions, you may have broken the law.”

The Hatch Act is a 1939 federal statute that prohibits federal employees from directly supporting political candidates, or using their “official authority or influence for the purpose of interfering with or affecting the result of an election.”

While the penalties for violating the act are largely administrative, if Comey was determined to be in violation of the 77-year-old law, that could serve as grounds for his firing or demotion. But as of Monday, October 31, there had been no official inquiry as to whether Comey’s letter broke the law.

What appears more clear is that in sending the letter, Comey went rogue, breaking from well-established Justice Department policies.

Even Republicans, such as Fox News legal commentator Jean Pirro and conservative columnist George Will have condemned Comey’s decision to send the letter — especially after it became clear by Sunday that neither Comey nor any FBI investigators had seen the emails he referenced in his letter, had any knowledge of what they contained — or even if any of the emails were sent by or to Hillary Clinton.

According to a former Justice Department official, Matthew Miller writing Saturday in The Washington Post, while Comey may or may not have violated a law, he broke with longstanding practice, tradition and Justice Department guidelines when he wrote Friday’s letter, making a public comment on an ongoing investigation.

“There’s a longstanding policy of not doing anything that could influence an election,” George J. Terwilliger III, who was deputy attorney general in the George Bush administration told The New York Times on Saturday. “Those guidelines exist for a reason. Sometimes, that makes for hard decisions. But bypassing them has consequences.”

“There’s a difference between being independent and flying solo,” the former Bush administration official added.

Comey also directly defied the wishes of Attorney General Loretta Lynch and her deputy, Sally Yates, who wanted the FBI director to stick to long-established tradition and keep his comments about matters that could have a bearing on the presidential election to himself, CNN reported.

“Justice officials didn’t sign off on Comey’s decision and he didn’t seek their approval,” the CNN report noted.

“Director Comey understood our position. He heard it from Justice leadership. It was conveyed to the FBI, and Comey made an independent decision to alert the Hill,” one current Justice Department official told The Washington Post, also in a Saturday story. “He is operating independently of the Justice Department. And he knows it.”

“Justice traditionally bends over backward to avoid taking any action that might be seen by the public as influencing an election, often declining to even take private steps that might become public in the 60 days leading up to an election,” Miller wrote. “This entire episode has exposed a troubling character flaw that calls into question Comey’s very fitness to lead the FBI…. He seems to have become intoxicated by the plaudits that have come his way. That praise has emboldened him to ignore the rules that apply to others, both because he believes in his own reputation and because he wants to thwart critics such as Republicans in Congress who might question it.”

Miller added that in previous cases involving public officials up for election, the Justice Department has held off on issuing subpoenas until the election was complete, as well as refraining from public comment.

4. Comey Himself Appeared to Question His Own Actions

FBI Director James Comey’s Internal Memo On Hillary Investigation Was Just LEAKED pic.twitter.com/vT5Thf03Fx — Lawrie J (@tjalm) October 29, 2016

In an internal memo to FBI employees, that leaked to the press on Friday, Comey appeared unsure of the justification for sending the letter to congress — admitting that by sending the letter he would create “a significant risk of being misunderstood,” and that the FBI normally does not comment about ongoing investigations.

“Of course, we don’t ordinarily tell Congress about ongoing investigations, but here I feel an obligation to do so given that I testified repeatedly in recent months that our investigation was completed,” Comey wrote in the leaked memo. “I also think it would be misleading to the American people were we not to supplement the record. At the same time, however, given that we don’t know the significance of this newly discovered collection of emails, I don’t want to create a misleading impression. In trying to strike that balance, in a brief letter and in the middle of an election season, there is significant risk of being misunderstood, but I wanted you to hear directly from me about it.”

5. The Clinton Campaign Was Furious at Comey Over the Vague Letter

Statement from John Podesta in Response to FBI Letter to GOP Congressional Chairmen pic.twitter.com/jQryUICjGP — Bradd Jaffy (@BraddJaffy) October 28, 2016

Clinton Campaign Manager John Podesta on Friday quickly released a statement blasting Comey, in which he called on the FBI to release full details of whatever new information they claim to have discovered, pointing out that “the Director himself notes that they [i.e. emails mentioned in Comey’s letter] may not be significant.”

Clinton herself also ripped Comey for the vague letter, delivered to the Republican chairs of eight different congressional committees.

“We are 11 days out from perhaps the most important national election of our lifetimes,” Clinton told reporters in Iowa later in Friday. “Voting is already underway in our country, so the American people deserve to get the full and complete facts immediately. We don’t know the facts, which is why we are calling on the FBI to release all the information that it has,” she said. “Even Director Comey noted that this new information may not be significant, so let’s get it out.”

At a campaign appearance Saturday in Florida, Clinton was even more pointed in her criticism of Comey.

“It is pretty strange to put something like that out with such little information right before an election,” she said at the rally. “In fact, it’s not just strange. It is unprecedented and it is deeply troubling.”

With Clinton clearly angry at Comey, if she wins the election and becomes president, will she fire him? If she tries — or requests his resignation — she will certainly face a considerable political backlash. But if she wants to hand Comey his pink slip, it appears that as president, she would be within her legal rights to do so.