Image copyright EPA Image caption The story centred around a call between Ukraine's President Volodymyr Zelensky and US President Donald Trump

You may have heard this one before: a controversy involving a foreign power that threatened the future of the Trump presidency.

Donald Trump was impeached over allegations he improperly sought help from Ukraine to boost his chances of re-election.

In the end, he was cleared on two charges by a majority of senators at this trial.

How did we get here? Let's break it down.

President Trump was accused of breaking the law by pressuring Ukraine's leader to dig up damaging information on a political rival.

In July 2019, he urged his Ukrainian counterpart to investigate one of the frontrunners to take him on in the 2020 presidential election. This mattered, opposition Democrats said, because it is illegal to ask foreign entities for help in winning a US election. He says he has done nothing wrong.

After Mr Trump was impeached in December, a trial took place that could have led to the president being removed. In the end, he was cleared.

At the heart of this story was a complaint from an unknown whistleblower.

In August 2019, an anonymous intelligence official wrote a letter expressing concern over President Trump's 25 July phone conversation with Ukraine's president.

The official spoke of an "urgent concern" that Mr Trump had used his office to "solicit interference from a foreign country" in the 2020 election.

A rough transcript of the call later revealed Mr Trump had urged President Volodymyr Zelensky to investigate former US Vice-President Joe Biden, the frontrunner to take on Mr Trump in the 2020 election, as well as Mr Biden's son.

The call came shortly after Mr Trump had blocked the release of military aid to Ukraine. A senior official later testified the president had made clear the release of this aid was conditional on Mr Biden being investigated. The White House denies this.

Media playback is unsupported on your device Media caption What we know about Biden-Ukraine corruption claims

Mr Trump and his supporters alleged Mr Biden abused his power to pressure Ukraine to back away from a criminal investigation that could implicate his son, Hunter, who worked for a Ukrainian energy company.

But these allegations were widely discredited. There is no evidence that Mr Biden took any action to intentionally benefit his son, nor is there any evidence of wrongdoing by Hunter Biden.

Congressional Democrats said the phone call was proof Mr Trump broke the law by seeking foreign help to try to smear Mr Biden.

But there was debate over whether soliciting opposition research from a foreign government constituted an impeachable offence. President Trump says it's a "witch hunt".

The Democrat-held House of Representatives impeached him on two charges - abuse of power and the obstruction of Congress. But to remove Mr Trump, senators from his own Republican Party would have needed to turn against him at his trial, which didn't happen.

President Trump says he called his Ukrainian counterpart Volodymyr Zelensky on 25 July 2019 to congratulate him on his election victory. Mr Zelensky, a former TV star with no political experience, had been elected president three months earlier.

But an anonymous whistleblower, reported to be a CIA official, felt there was something more serious in their exchange, and explained why in a formal complaint on 12 August.

The whistleblower admitted having not directly heard the call but said accounts shared by other officials had painted a consistent picture. For context, about a dozen people are reported to have listened in on the conversation, including Secretary of State Mike Pompeo.

The call occurred days after Mr Trump blocked $391m (£316m) in military aid to Ukraine. Critics argued this was used as a bargaining chip, but Mr Trump denied this.

Media playback is unsupported on your device Media caption Trump: "It's a partisan whistleblower"

The whistleblower alleged the president used "the power of his office to solicit interference from a foreign country" in the 2020 presidential election, adding that White House officials were "deeply disturbed" by the call and had acted to "lock down" all details of it.

As the controversy grew, Mr Trump promised to release a "complete, fully declassified and unredacted transcript" he said would prove the call had been "totally appropriate".

But details disclosed by the White House were notes of the conversation and not a full, verbatim account. It did little to quell the spiralling controversy.

The notes showed Mr Trump had urged Mr Zelensky to investigate discredited corruption allegations against former Vice-President Joe Biden, a frontrunner for the Democratic presidential nomination in the 2020 election, as well as Mr Biden's son.

Mr Trump and his allies suggested that Mr Biden, as Barack Obama's vice-president, encouraged the firing of Ukraine's top prosecutor in 2015 because he had been investigating an energy company which employed Hunter Biden.

At the time, by working closely with foreign-owned entities while his father was in the White House, Hunter Biden was criticised for leaving his father exposed to suggestions of a possible conflict of interest. But no evidence emerged that Mr Biden did anything to intentionally benefit his son.

Hunter Biden denied wrongdoing and officials in Kiev said there was no evidence to support the allegations.

Image copyright Pool/Getty Images Image caption Then-President Barack Obama sits with then Vice-President Joe Biden and his son Hunter at a basketball game in 2010

Mr Trump pressing a foreign leader to investigate discredited allegations against Mr Biden was significant. If he wins the Democratic nomination, Mr Biden would be the man facing Mr Trump for the presidency in November 2020.

As Mr Biden is a leading rival for the presidency, it opened Mr Trump up to claims he was working with a foreign power to influence the election. This - crucially - is against the law.

This was not the first time Mr Trump has been scrutinised over his foreign connections. His 2016 election campaign was investigated over its alleged ties to Russia. The inquiry didn't establish a criminal conspiracy to influence the election, but it also didn't exonerate the president of obstructing justice.

The Democrats launched a formal inquiry into the Ukraine affair and a number of officials were called to testify. They included the US government's special envoy to Ukraine, Kurt Volker, who turned over a trove of text messages and other communications.

The acting ambassador to Ukraine, Bill Taylor, told the inquiry that Mr Trump had made the release of the military aid conditional on Ukraine opening an investigation into the Bidens' dealings. He also said there was "an irregular, informal channel of US policymaking" in the country more generally. The White House denied this was the case.

The president's personal lawyer, Rudy Giuliani, was subpoenaed for documents relating to Ukraine. He has been central in pushing the allegations against the Bidens. Mr Pompeo has also been served with a subpoena.

But the most dramatic testimony came from Gordon Sondland, the US ambassador to the European Union. He told Congress that he was working at the "express direction" of the president when pressure was put on Ukraine to investigate the Bidens. Mr Sondland added that an offer of a White House visit for Ukraine's president was conditional on the country publicly announcing a probe.

He also implicated Mr Pompeo and former National Security Adviser John Bolton in the Ukraine dealings.

In December, Democratic leaders in the US House of Representatives unveiled two impeachment charges - abuse of power and the obstruction of Congress.

Then, a week before Christmas, the House voted to impeach Mr Trump, ensuring he became only the third US president to suffer the same fate (after Andrew Johnson and Bill Clinton).

Over two weeks in January and February 2020, the Senate held a trial. A Senate vote requires a two-thirds majority to convict, so a guilty verdict was always unlikely given that Mr Trump's party controls the chamber.

And this is how it came to pass. Mr Trump was cleared - by 52 votes to 48 on one count, and 53 votes to 47 on the other.

Learn more about Trump and impeachment inquiry