Image copyright Reuters

The investigation of Hillary Clinton's private email arrangements is once again in the spotlight. So what was it all about?

FBI boss James Comey has been fired because he mishandled the Clinton investigation, says the White House.

It's a saga that has dogged the former secretary of state and one which many of her supporters say was responsible for her election defeat.

This is what we know about it.

What was the initial scandal about?

Before becoming secretary of state in 2009, Mrs Clinton set up an email server at her home in Chappaqua, New York, that she used for all work and personal emails during her four years in office.

She did not use, or even activate, a state.gov email account, which would have been hosted on servers owned and managed by the US government.

She said it was for convenience.

"I thought using one device would be simpler, and obviously, it hasn't worked out that way," she said.

But critics said it gave her control over what information entered the public domain.

What is the email scandal all about?

Was it against the law?

Probably not. Mrs Clinton's email system existed in a grey area of the law - and one that has been changed several times since she left office.

When she became secretary of state, the controlling interpretation of the 1950 Federal Records Act was that officials using personal email accounts must ensure that official correspondence is turned over to the government. Ten months after she took office, a new regulation allowed the use of private emails only if federal records were "preserved in the appropriate agency recordkeeping system".

Mrs Clinton maintains that this requirement was satisfied because most of her emails from her personal account went to, or were forwarded to, people with government accounts, so they were automatically archived. Any other emails were turned over to State Department officials when they issued a request to her - and several of her predecessors - in October 2014.

A State Department investigation said her arrangement violated government policy, and FBI boss James Comey said in July 2016 that it was careless but not criminal.

So why wasn't that the end of it?

In a bombshell announcement on 28 October, the FBI said it had found new emails that "appeared to be pertinent" to its investigation.

The emails, including some from top Clinton aide Huma Abedin, were found on a laptop belonging to her estranged husband, former congressman Anthony Weiner.

The revelation angered the Clinton campaign, and Mr Comey came under fire from some Democrats for allegedly interfering in the election.

Donald Trump, meanwhile, seized on the news to accuse Mrs Clinton of grand corruption.

And he praised Mr Comey, saying it "took guts" for him to make the intervention.

But in the final days of a heated election campaign, Mr Comey said that after reviewing the newly discovered emails, the FBI had not changed its position that Mrs Clinton should not face criminal charges.

Mr Trump changed his tune, saying Mrs Clinton was "being protected by a rigged system".

Media playback is unsupported on your device Media caption Donald Trump: "Hillary Clinton is guilty. She knows it. The FBI knows it"

Did Comey's late intervention swing the election?

Mrs Clinton thinks so, citing it as a major factor in her surprise defeat.

Political analyst Nate Silver agrees, saying it "probably" cost the former first lady a return to the White House as president.

This is what BBC North America reporter Anthony Zurcher said at the time:

When determining the political fallout of this latest development, it's worth remembering that the race between Mr Trump and Mrs Clinton was already tightening in the days leading up to the first Comey letter.

Surveys taken after the revelation indicated that few Americans considered the story grounds for changing their vote. The divide between the two candidates is simply too great to allow much ticket-switching at this point.

What the story did do was knock Mr Trump out of the headlines for over a week, giving him space to bring disaffected Republicans back into the fold. It also prevented Mrs Clinton from ending the campaign on a positive message and increased negative perceptions of her, which will make it harder for her to govern if she is elected.

Once this election is in the rear-view mirror, there will have to be a lot of soul-searching within the FBI and the media about how this story has played out and been covered. Following Mr Comey's original letter, the nation's top law-enforcement became a constant source of leaks, as internal factions and disputes spilled into public view.

How FBI email verdict affects election

And what's happened since the election?

The investigation remains closed but the debate about Mr Comey's actions rages on.

The anger felt by Clinton supporters was compounded when it emerged that the FBI had been looking into any links between the Trump campaign and Russia, but Mr Comey chose not to go public with it.

In May, he gave evidence to a Senate Judiciary Committee and defended himself.

He said that it was a "painful" dilemma when he decided to make his October pronouncement, but if he had not come forward about the new Clinton emails, he would have been guilty of concealment.

Mr Comey said he felt "nauseous" at the thought he might have had an impact.

Deconstructing Comey's testimony