Julian Assange’s dramatic arrest on Thursday happened because the government of Ecuador — which had protected the WikiLeaks founder in its London embassy for seven years — finally decided to kick him out.

So why did the Ecuadorians suddenly turn on their controversial lodger? The decision came down to two completely different rationales: a desire for better relations with the US, and exasperation with Assange’s horrible houseguest etiquette.

“We’ve ended the asylum of this spoiled brat,” Ecuadorian President Lenín Moreno said Thursday in a stunning address. “From now on we’ll be more careful in giving asylum to people who are really worth it, and not miserable hackers whose only goal is to destabilize governments.”

The hacker, wanted by the US for allegedly breaking into a secret government computer, entered the small Ecuadorian Embassy in London in June 2012, seeking asylum to avoid extradition related to sexual assault allegations against him in Sweden. Ecuador’s president at the time, Rafael Correa — a leftist anti-American firebrand — granted Assange’s request.

Assange proceeded to turn his tiny office-cum-bedroom into a new headquarters for WikiLeaks’ operations. And then he did the two things a man in his position shouldn’t do.

First, he kept interfering in politics, most famously releasing stolen emails related to Hillary Clinton’s campaign. It also appears that he targeted his hosts, perhaps even playing a role in releasing documents showing Moreno had personally benefited from offshore accounts.

In a sovereign decision Ecuador withdrew the asylum status to Julian Assange after his repeated violations to international conventions and daily-life protocols. #EcuadorSoberano pic.twitter.com/pZsDsYNI0B — Lenín Moreno (@Lenin) April 11, 2019

Second, he failed to respect his makeshift home by verbally and perhaps physically abusing staff and, most shockingly, spreading feces on the walls.

Put together, Assange made life difficult for his hosts inside and outside the embassy — and Ecuador finally had enough.

Ecuador now wants better ties with the US. Assange impeded that.

Ecuador’s changing attitudes toward Assange parallel the South American nation’s shifting politics.

Correa, who was president from 2007 to 2017, was an anti-American politician who enjoyed annoying the US whenever he could. Letting Assange stay in his UK mission, and away from British and American custody, was his pièce de résistance.

“Correa took great pleasure in criticizing the United States and thumbing his nose at the geopolitical status quo,” John Polga-Hecimovich, an Ecuador expert at the US Naval Academy, told me. Correa viewed his Assange decision “as a type of small-country power move.”

It’s therefore no surprise that US-Ecuador relations became more and more strained during Assange’s lengthy stay at the London embassy.

Exports from Ecuador to the United States plunged from around $11 billion in 2014 to $7.5 billion in 2015. Making it worse, that drop-off led the country to turn to China for financial help. And it didn’t improve matters that Correa was allied with Cuba and Venezuela, both longtime US adversaries.

Experts expected the rift to continue when Moreno, Correa’s vice president and handpicked successor, took office in 2017. But the new leader quickly decided that he couldn’t fix his country’s many economic woes as long as it protected Assange.

“Assange impeded Moreno’s ability to seek technical assistance, international loans, and greater security and commercial cooperation with the United States,” says Polga-Hecimovich. All of that was badly needed if Ecuador was going to rebound from Correa’s economic mess.

To remedy the problem, Moreno tacked more to the political center as a way to attract foreign investment. Those efforts were noticed by the United States.

“Prior to your election, our nations had experienced 10 difficult years where our people always felt close but our governments drifted apart,” Vice President Mike Pence said alongside Moreno in Quito, Ecuador’s capital, last June. “But over the past year, Mr. President, thanks to your leadership and the actions that you’ve taken have brought us closer together once again.”

Likely helped, at least in part, by the thawing in relations with the US, Ecuador in March received a $4.2 billion loan from the International Monetary Fund to help rebuild the nation’s economy.

It’s therefore possible that Moreno’s politics alone would’ve made Assange’s release unnecessary, allowing Ecuador to ingratiate itself with the US despite that thorny issue.

But Assange, well, shit all over that possibility.

Assange was the worst houseguest. Seriously, the worst.

The first rule of being a houseguest: Don’t be rude and gross. The second rule, especially if you’re a notorious global hacker, is don’t spy on your hosts.

Assange broke both of them, even as Ecuador spent $1 million a year to protect him.

Over the years, the WikiLeaks chief clearly grew too complacent with his surroundings. He would skateboard at night, play music extremely loudly, and even walk around in his underwear, according to NBC News. It’s reminiscent of Home Alone, except that it wasn’t his home, he wasn’t alone, and he was the (alleged) criminal.

But his behavior was also downright rude — and more than a little gross. He barely maintained his own personal hygiene, leading the smell from his room to infest the rest of the embassy. He refused to clean up or even feed his cat. And he almost came to blows with the mission’s security staff. As if that wasn’t enough, he acted out and on at least one occasion smeared his feces on the wall.

The embassy tried to rein him in. In March 2018, for example, Ecuador took away his internet in a kind of geopolitical timeout for grown-ups. Assange eventually regained internet access, but only for his personal computer and phone.

All of that, though, didn’t tip the scales. What did, experts say, is that he may have targeted Moreno.

In February 2019, an anonymous website leaked photographs of Moreno’s family and documents that show he and his brother may have profited from offshore accounts in Panama. Assange and WikiLeaks deny having anything to do with that website, but Moreno did all but accuse the embassy denizen of being behind the site. Moreno also denies any wrongdoing.

And so, with Moreno’s government furious at him, it was likely that Assange’s time as Ecuador’s guest would soon come to an end.

“When you’re given shelter, cared for and provided food, you don’t denounce the owner of the house,” Moreno said on Thursday.