For almost seven years, Julian Assange has lived in the Ecuadoran Embassy in London. The WikiLeaks founder feared that if he left the diplomatic outpost, located in an apartment building in the Knightsbridge neighborhood, British authorities would arrest him.

In the end, however, Assange didn’t need to be kicked out for British police to arrest him: Police officers went into the embassy. A video of the arrest showed Assange, gray-bearded and pale after years indoors, being pulled out of the embassy and pushed into a police van.

But how were British police officers legally able to enter the building, if it was under the diplomatic control of Ecuador? The answer is simple: Ecuador allowed them to.

On social media, some supporters of Assange said the act was in violation of the Vienna Convention, an international accord that dictates how host countries should treat diplomats and embassies on their soil. Assange, an Australian citizen, had claimed political asylum in the Ecuadoran embassy in 2012.

There is understandable confusion about how embassies and consulates operate, with many mistakenly claiming they are sovereign territory that the host country cannot violate. But the 1961 Vienna Convention on Diplomatic Relations does lay out parameters for how embassies and consulates interact with their host countries under international law. These rules are rarely broken.

One element of the Vienna Convention is that police and security officials cannot enter an embassy simply because they want to. This was why Turkish authorities did not immediately search the Saudi consulate in Istanbul last year after the disappearance of Washington Post contributing columnist Jamal Khashoggi, for example.

It is also why British authorities did not enter the Ecuadoran Embassy for years, even though they were prepared to arrest Assange the moment he left and the surveillance came at considerable cost to the British state. The British Foreign Office even argued in 2012 that it had the right to revoke the embassy’s diplomatic status under the country’s Diplomatic and Consular Premises Act, passed in 1987, but it ultimately did not carry through on this threat.

Article 22 of the Vienna Convention is quite clear that police and security officials cannot enter a diplomatic building. However, it does allow for one exemption: when the head of the diplomatic mission requests their presence.

“The premises of the mission shall be inviolable,” the text reads. “The agents of the receiving State may not enter them, except with the consent of the head of the mission.”

Ultimately, it appears to have been the deterioration of relations between Assange and his hosts that legally allowed British police to enter the building. London’s Metropolitan Police said in a statement Thursday that they were “invited into the embassy by the ambassador, following the Ecuadoran government’s withdrawal of asylum.”

Ecuador also released a statement that said it was rescinding asylum because of Assange’s “discourteous and aggressive behavior,” arguing that he had broken the terms of his asylum.

“Ecuador has sovereignly decided to terminate the diplomatic asylum granted to Mr. Assange in 2012,” President Lenín Moreno said in a video statement on Twitter. “The asylum of Mr. Assange is unsustainable and no longer viable.”

Read more: