It was a relationship that would only grow more complex — and more contentious — after Trump won the election and Comey headed an investigation into his campaign's ties to Russia.

Trump fired Comey on Tuesday — but like all failed relationships, its ghost will linger long after its end. Here's how we got to this point — and what's next for Trump and Comey.

A timeline of Trump and Comey's rocky relationship

President Donald Trump shakes hands with former FBI Director James Comey. Pool/Getty Images

In June, Comey announced that he would not be recommending charges against Clinton stemming from her use of a private email server.

"Our judgment is that no reasonable prosecutor would bring such a case," Comey said in a press conference. "We cannot find a case that would support bringing criminal charges on these facts."

Trump — in the middle of a nasty campaign against Clinton — lashed out at Comey on Twitter, writing that the decision not to bring charges showed "bad judgment."

But then, 11 days before the election, Comey wrote in a letter to Congress that he was reopening his investigation into Clinton's emails after finding a cache of Huma Abedin messages in a separate investigation into the top Clinton aide's husband, Anthony Weiner, who was discovered to have been sending sexually explicit texts to a 15-year-old girl.

Trump at the time remarked that Comey reviving his opponent's email scandal "took guts."

"It took guts for Director Comey to make the move that he made in light of the kind of opposition he had, where they're trying to protect her from criminal prosecution," Trump told a crowd at a rally in October. "I really disagreed with him. I was not his fan. But I'll tell you what: What he did, he brought back his reputation."

Of course — despite Trump's claim that the reopened investigation would yield an indictment — the review didn't change the FBI's position.

But many, including the candidate herself, believe that Comey's letter was a stick in the spokes of the Clinton campaign during the final stretch of the race and was a factor in Trump's unlikely victory — a belief that continued to frustrate Trump months later.

In the aftermath of Comey's firing this week, new information is coming out about the worsening relationship between the two in the months since Trump took office.

In March, Comey publicly confirmed that the FBI is investigating the president's ties to Russia — and that there was "no information" to support Trump's claim that his predecessor, Barack Obama, had wiretapped him.

Comey, it was reported Wednesday, described Trump as "outside the realm of normal" and "crazy" after he made the bizarre accusation.

But Trump, meanwhile, was apparently furious that Comey dismissed the wiretap claims and has repeatedly railed against suggestions that he has connections to Russia — despite the fact that his national security advisor, Michael Flynn, had to resign over a Russia scandal just weeks into the presidency.

Trump has attempted to distract from Flynn's ongoing Russia scandal by focusing on the leaks that brought the former general down — and frustration that Comey did not pursue the source of the leaks is said to be part of the reason Trump fired him.

According to Trump, he fired Comey because he mishandled the Clinton investigation. But Democrats — and some Republicans — found that reasoning to be disingenuous, given his past comments about Clinton, including that she should be "in jail."

What's next for Trump and Comey?

A protester holds a sign at an anti-Trump demonstration following the termination of FBI Director James Comey. Marcio Jose Sanchez/AP

Trump firing the official heading an investigation against him has drawn comparisons to President Richard Nixon's "Saturday Night Massacre" — and has invited harsher scrutiny than any other controversy in his scandal-ridden presidency so far.

The odds of Trump's impeachment have spiked online in the two days since the firing, and former George W. Bush ethics lawyer Richard Painter called Comey's termination was "worse than Watergate." Days before he was fired, Comey had reportedly asked for more resources for the investigation into Russia's election interference — and at least one Democrat has suggested that the sacking came because Comey was "beginning to get too close" to the truth about Trump.

Comey has been asked to appear before the Senate Intelligence Committee in a closed session next Tuesday. Meanwhile, calls are growing for the government to appoint a special prosecutor to carry out the Russia-Trump investigation.

Trump apparently wasn't expecting all this when he decided to fire Comey. Because Democrats criticized Comey for his handling of Clinton's email probe, Trump had believed canning him would be a "win-win" and was "taken aback" when the decision did not get bipartisan support.

But those criticizing Trump for the controversial firing are "phony hypocrites," according to Trump, and simply don't recognize what a good and selfless decision it was for him to dismiss Comey.