NEW YORK • The secrets came directly from the phones of President Lenin Moreno of Ecuador: intimate pictures of him and his family on vacation, text messages from his wife, even a photograph of the President himself in a posh bedroom, eating a lobster in bed.
The material, published last month on an anonymous website, was particularly embarrassing because Mr Moreno was in a bruising national fight over his austerity measures.
But rather than mount a defence, the President played the victim: He blamed WikiLeaks, whose founder, Julian Assange, had spent the last seven years holed up in the country's London embassy. WikiLeaks' actions were "despicable", said the country's Vice-President on television, vowing to take action.
With that, Assange's long refuge inside the Ecuadorean Embassy finally came to an end, the capstone of an international cat-and-mouse game involving stolen document dumps, promises of more to come, failed efforts to contain him and accusations of blackmail.
Even as Ecuador harboured Assange from international prosecution, he and WikiLeaks wielded the threat of releasing damaging information against its government.
In October 2016, as WikiLeaks was releasing thousands of e-mails hacked from the Democratic National Committee and the personal account of Mr John D. Podesta, chairman of the Hillary Clinton campaign, Ecuador restricted Assange's access to the Internet, citing his interference in a foreign election.
The United States may have played a central role in the effort to corral Assange.
On Oct 14, with the e-mails upending the campaign and the election just weeks away, a confidante of Mr Bill Clinton and his wife Hillary, and a top aide to Secretary of State John Kerry showed up at a dinner party hosted by the Ecuadorean ambassador before a ball, lingering with him as other guests left, several attendees said.
Assange's Internet access was curtailed by the Ecuadorean Embassy the next day.
But WikiLeaks quickly retaliated, issuing a cryptic message that a leak against Ecuador was on its way. The tactic seemed to work. Two months later, Assange said in an interview that his Internet access had been restored.
Assange has been hailed by many around the world as a champion of transparency and a casualty of his own success at revealing secrets.
In Britain, the leader of the opposition Labour Party, Mr Jeremy Corbyn, said last week that his country should oppose the extradition of Assange to the US - where he faces a charge of conspiring to hack a Pentagon computer network in 2010 - because the WikiLeaks founder was being pursued for "exposing evidence of atrocities in Iraq and Afghanistan".
Ms Diane Abbott, another Labour Party official, made the same assertion, arguing that Assange "is not being pursued to protect US national security; he's being pursued because he has exposed wrongdoing by US administrations and their military forces".
But Ecuadorean officials contend that the expulsion comes from an extensive list of transgressions by Assange that soured their long - and often strained - relationship.
In explaining his decision, Mr Moreno accused Assange of installing electronic distortion equipment in the embassy, blocking security cameras, confronting and mistreating guards and gaining access to security files without permission.
Last Thursday, the government said it had also arrested a computer programmer in Ecuador in connection with the Assange case, contending that WikiLeaks had interfered in Ecuador's domestic political affairs.
WikiLeaks insisted that it was not involved in the hacking of Mr Moreno's phones, and that the Ecuadorean government was using the episode as a false pretext to toss out Assange.
It was no secret that the United States wanted him removed. It was also clear that Mr Moreno is eager for international loans and better relations with the US after the tensions that festered under his leftist predecessor, who granted Assange shelter in the embassy. "I inherited this situation," Mr Moreno said in a video address this week.
Assange's odyssey with Ecuador began in 2012, when he skipped a bail hearing to avoid being extradited to Sweden, where he was wanted for questioning in connection to accusations of "rape, sexual molestation and unlawful coercion".
Ecuador's President at the time, Mr Rafael Correa, had been criticised in his own country for a crackdown against the press. But in Assange, the Ecuadorean President found a symbol of his challenge to the US, which he called an imperialist power.
Assange was free to stay in the embassy as long as he pleased, Mr Correa said. But by 2016, a change in power was afoot in both the US and in Ecuador.
Mrs Hillary Clinton, who had run the State Department during the enormous leak of information by WikiLeaks in 2010, was running for president. Assange also had reason to worry about the coming election in Ecuador, where his stay in the embassy was becoming a campaign issue as well.
On Oct 7, 2016, a tape was leaked showing Mrs Clinton's opponent, Mr Donald Trump, boasting of sexually harassing women while filming a segment for the show Access Hollywood, sending Mr Trump's campaign into a major crisis.
Less than an hour later, WikiLeaks began publishing the first of thousands of hacked e-mails from Mr Podesta's account, creating a different controversy in the Clinton camp.
WikiLeaks continued to release the e-mails daily throughout October. US intelligence agents later concluded that the documents had been hacked by Russian operatives and laundered through WikiLeaks.
When Ecuador restricted Assange's Internet access in response, the Correa administration said that it had acted on its own accord, not because of pressure from the US.
A spokesman for Mr Kerry also denied that the Obama administration played any role.
But during the encounter on Oct 14 - the night before Assange's Internet access was restricted - Ms Patsy Thomasson, a veteran of the Clinton White House, and a senior aide to Mr Kerry, attended a dinner at the Ecuadorean Embassy hosted by Mr Francisco Borja, the ambassador of Ecuador.
Attendees interviewed said it struck them as odd that such high-powered players would decide to attend a party hosted by a small country's ambassador.
They noted that neither Ms Thomasson nor the Kerry aide were dressed for the ball, and that both stayed behind with the ambassador after other guests left for the event.
Ms Thomasson, reached by phone, said that she had been invited at the very last minute by someone whose wife couldn't come, and that she did not recall having any conversations with the ambassador, "much less about Julian Assange".
WikiLeaks struck back soon after. On Oct 16, the day after Assange's Internet access was restricted, WikiLeaks tweeted a code, known in its parlance as an "insurance file", and signalled that an upcoming leak involving Ecuador was imminent.
According to former WikiLeaks insiders, Assange had damaging information about Ecuador and wasn't bluffing. Assange certainly seemed to have acquired compromising material.
In 2015, Ms Cynthia Viteri, a prominent Ecuadorean politician, and Mr Fernando Villavicencio, an Ecuadorean political journalist, had got secret documents showing that Ecuador was running a surveillance programme using an Italian company to spy on journalists and political enemies, in addition to spying on Assange at the embassy.
Mr Villavicencio said he sent the material to a WikiLeaks e-mail address, hoping the organisation would publish the information. He eventually published the documents himself.
WikiLeaks never did, though it is clear from leaked 2015 chat group logs from WikiLeaks Forum, a related site, that Assange and his inner circle were aware of them.
The controversy was just the beginning of Assange's difficulties.
Mr Moreno took over as president in May 2017 and soon broke with the policies of his predecessor.
Advisers to Mr Moreno held meetings with Paul Manafort, who had served as Mr Trump's campaign chairman, and raised the possibility of releasing Assange in exchange for concessions like debt relief.
Mr Moreno said repeatedly that Assange's time in the embassy should not be forever. Then, Mr Moreno's government was hit by a familiar disruption: more leaks.
In March, an anonymous website, INApapers.org, published around 200 private e-mails related to Mr Moreno, text messages written by his wife and photos of the president and his family taking luxurious vacations in Europe.
Mr Moreno's government was quick to blame the release on WikiLeaks, which it says Assange still controls.
On April 4, Mr Moreno repeated the claim, telling Ecuadorean journalists that Assange didn't have the right to "hack private accounts or phones".