Julian Assange has been given diplomatic asylum in the Ecuadorian Embassy in London. How did this peculiar situation arise and how will it end? I’m not concerned here with the rights and wrongs of the Assange story. In accordance with a court decision, the UK has a legal obligation to extradite him to Sweden, and is determined to fulfil that obligation, as the FCO has stated.

There are many myths about diplomatic immunity: that ambassadors are allowed to break the law, or that the Ecuadorian Embassy in London is legally Ecuadorian territory. I am not an international lawyer or a protocol expert, but, like all diplomats, I have some practical experience of the way diplomatic immunity and privileges work.

An important point to emphasise is that the rules are not British but international, accepted in principle by all governments. The British government cannot simply change the rules, although it can seek to get them changed – a tedious business – or of course it can break them, in which case it may pay a penalty.

Ambassadors (and their families and diplomatic staff) are expected to obey the law, but if they do not they are not subject to arrest or prosecution by the receiving government. So if, say, the French government thought the Australian ambassador in Paris had broken the law, their only option in the last resort would be to expel him. This is their absolute right, and they may or may not give any explanation when they do so. If the Australians feel wronged they may expel the French ambassador from Canberra in the same way.

The immunity of diplomatic premises stems from the immunity of the ambassador. The French authorities may not enter the Australian Embassy. When I told the Libyan government in Tripoli in 1984, following the murder of Yvonne Fletcher, that their staff in London had to leave within a certain number of days, and the Libyans ordered us out, the British police did not enter the Libyan Embassy as long as the Libyan diplomats remained, but they did so afterwards and the same thing happened in Tripoli.

There is an important exception: the Australians might invite the French to enter the embassy. The storming of the Iranian Embassy in London by the SAS in 1980 is an example. Armed men had seized the embassy and taken hostages, and the Iranian government asked the British government to deal with the situation.

Harbouring someone in the embassy needs to be considered according to these rules. There is little or no special doctrine about diplomatic asylum, not at least in Europe although there is a history in Latin America. Nor is there any form of diplomatic safe passage from asylum in an embassy to a port or airport; departure from the Australian Embassy would have to be courtesy of the French authorities, as in the case of Cardinal Mindszenty who was given asylum in the US Embassy in Hungary in 1956 and eventually left under arrangements negotiated with the Hungarian authorities 15 years later. Jeremy Harding quotes someone talking of Assange being ‘set on a rapid path to Ecuadorian citizenship and finally awarded a minor consular position, which gets him from the steps of the embassy to a boarding gate at Heathrow under diplomatic immunity’. That won't wash: you don't get diplomatic immunity in Britain until your name has been notified by your government and accepted by the FCO, which can refuse without giving reasons.

When Assange went into the Ecuadorian Embassy I assumed that the FCO would ask the Ecuadorians either to hand him over or let the British police go in and get him. Not to do so would send a message to every crook in London: find an ambassador, pay him off, and you have free passage to the Costa del Crime.

If the Ecuadorians said no, the British government would be under no international diplomatic obligation to take the matter further, but if they did not do so they could not fulfil their obligation under British and European law to extradite Assange to Sweden. I would assume that they would assess their options, up to and including expelling the ambassador, considering ways to get the Ecuadorians to change their position, and taking into account other British interests that might be at risk. Timing is always important, and in this case it seems that the British government need be in no particular hurry.

My experience is that in any significant diplomatic crisis some of the facts will be public knowledge but others will not. I do not therefore criticise the government's inaction so far or speculate what other factors they may be considering. But I do wonder about one thing: why has nobody asked them?