By all accounts, Donald Trump and James Comey have enjoyed a roller-coaster relationship. The Republican candidate-turned-US president and his White House staff are entangled in a web of contradicting statements before and after the dismissal of the former FBI director.

If you're finding it hard to keep track of all the latest developments, here is a timeline to help.

July 5, 2016 - Comey says the FBI will recommend to the justice department that no prosecution is warranted after a year-long investigation into Hillary Clinton's use of a private email server during her time as secretary of state. Trump, still a Republican candidate, reacts by saying: "Today is the best evidence ever that we've seen that our system is absolutely, totally rigged. It's rigged".

October 12, 2016 - Trump promises to investigate the FBI's investigation into Clinton's email usage: "And furthermore we are going to investigate this phony investigation. It's a phony investigation," he said at a campaign rally in the state of Florida.

October 31, 2016 - After Comey announces the reopening of the investigation into Clinton's emails, less than two weeks before the November 8 election, Trump is full of praise for the FBI director.

"It took a lot of guts. I really disagreed with him. I was not his fan. But I'll tell you what, what he did, he brought back his reputation. He's got to hang tough, because there's a lot of people who want him to do the wrong thing. What he did was the right thing."

November 6, 2016 - Comey tells Congress that the FBI has not changed its conclusions over Clinton's emails, saying she should not face any charges. In response, Trump says: "Hillary Clinton is guilty. She knows it, the FBI knows it, the people know it. She is being protected by a rigged system. It's a totally rigged system."

January 22, 2017 - Two days after being sworn in as president, Trump holds a White House reception for first responders and law enforcement. He welcomes Comey with comments such as, "Oh, there's James, he's become more famous than me," before patting him on the back and shaking his hand.

March 20, 2017 - Comey confirms in a House Intelligence hearing that the FBI is investigating alleged links between Trump's presidential campaign and Russia. White House Press Secretary Sean Spicer says "there's no reason to believe he doesn't [have the president's full confidence] at this time".

April 12, 2017 - Speaking to US network Fox, Trump says "it's not too late" to fire Comey. "But, you know, I have confidence in him. We'll see what happens. You know, it's going to be interesting."

May 2, 2017 - Clinton says questionable decisions by the FBI, along with misogyny and Russian interference, influenced the outcome of the November 8 election. "I was on the way to winning until a combination of Jim Comey's letter on October 28 and Russian WikiLeaks raised doubts in the minds of people who were inclined to vote for me but got scared off," she said.

Later, Trump tweets that Comey was "the best thing that ever happened to Hillary Clinton in that he gave her a free pass for many bad deeds".

May 9, 2017 - In a shocking move, Trump fires Comey. A letter released to the public says his decision was based on the recommendation of Attorney General Jeff Sessions and Deputy Attorney General Rod Rosenstein.

May 10, 2017 - Trump tweets that Comey had lost everybody's confidence, adding he aims to "bring back the spirit and prestige of the FBI".

May 10, 2017 - Deputy Press Secretary Sarah Huckabee Sanders says Trump was considering firing Comey "since the day he was elected".

May 11, 2017 - Trump tells NBC he wanted to fire Comey regardless of recommendations made by the attorney general and deputy attorney general. He says the FBI had been "in turmoil" for one year and still has not recovered today.

May 11, 2017 - Acting FBI Director Andrew McCabe tells the Senate Intelligence Committee that "Comey enjoyed broad support within the FBI and still does to this day".