A LEGENDARY Ecuadorean leader, José María Velasco, once declared “give me a balcony and I will become president”. He did, five times, only to be overthrown by the army on four occasions. Rafael Correa, who resembles Mr Velasco in his histrionic populism, clearly hopes that his decision on August 16th to grant Julian Assange, the founder of the WikiLeaks website, asylum at Ecuador’s embassy in London—and the use of its balcony to address his supporters (pictured)—will boost his chances of winning another term at an election due in February. The affair has certainly granted Mr Correa a rare moment of global celebrity. But whether it will redound to his long-term advantage is not clear.

Since coming to power in 2007, Mr Correa has enjoyed durable popular support by leading what he calls a “citizens’ revolution” in a country that was a byword for political instability. He has used an oil windfall and money saved by defaulting on bonds to boost social spending. He has combined this with bouts of theatrical anti-Americanism. He refused to renew an agreement allowing an American anti-drug base in Ecuador. He has teamed up with communist Cuba and Venezuela’s Hugo Chávez in an anti-American alliance known as ALBA (meaning “dawn” in Spanish). When WikiLeaks published a cable in which the American ambassador in Quito, Heather Hodges, alleged that the president knew that his police chief was corrupt, Mr Correa expelled her.

In June Mr Assange took refuge in Ecuador’s London embassy, a flat in a redbrick mansion-block behind Harrods department store, to avoid extradition to Sweden, where he is wanted for possible indictment for sexual assault. (He says the sex was consensual.) In granting him asylum, Mr Correa claims to be defending freedom of speech. The foreign minister, Ricardo Patiño, last month described the Swedish accusations as “hilarious”, claiming that they were a ruse to facilitate Mr Assange’s onward extradition to the United States, where he might face the death penalty. But international lawyers argue that this would be harder from Sweden than from Britain. The United States has not indicted Mr Assange, although it is trying Bradley Manning, the soldier accused of passing thousands of confidential cables to WikiLeaks, for “aiding the enemy”.

Some of Mr Correa’s opponents argue that he is using the Assange case to wrest the initiative within ALBA from Mr Chávez, who has been ill with cancer. Earlier this year, Mr Correa called for sanctions against Britain because of its refusal to negotiate about its sovereignty over the Falkland Islands, and boycotted a 34-country Summit of the Americas in protest at Cuba’s exclusion.

Mr Correa seized on an ill-advised letter from the British ambassador, which referred to a British law allowing an embassy’s inviolability to be revoked if the premises were misused. He called this a threat “to storm” the embassy. Britain’s foreign secretary, William Hague, denied that the government had made any such threat, and said that he was committed to settling the dispute through negotiations.

The letter allowed Mr Correa to cast the Assange case as a struggle between a small country and “imperialist” powers. Unsurprisingly, he has gained the backing of his ALBA partners. He also claimed victory at a specially convened meeting in Guayaquil of UNASUR, the South American Union, on August 19th. But while UNASUR declared its solidarity with Ecuador over any threat to its embassy and affirmed the right to diplomatic asylum, it did not give explicit support to Mr Correa’s harbouring of Mr Assange. Several countries, including Brazil, sent officials, not foreign ministers, to the meeting.

Diplomatic or lunatic?

The right to grant asylum in embassies is not recognised by international law or the Vienna Convention on Diplomatic Relations of 1961. Latin America is the only region in the world where this practice is established—a consequence of the region’s history of political repression. After a dictator took power in Peru in 1948, Victor Raúl Haya de la Torre, a Peruvian politician, found refuge in the Colombian embassy in Lima for six years, while army tanks surrounded the building.

Mr Correa has said that Ecuador might take the Assange case to the International Court of Justice (ICJ). But the ICJ issued a categorical ruling in the Haya de la Torre case that diplomatic asylum can exist only under explicit treaties or reciprocal usage. Britain is party to no such treaties. (Neither is the United States: after a Chinese dissident took refuge in its Beijing embassy in April, it handed him back to China having negotiated his safe passage out of the country.) After the ICJ ruling, the Organisation of American States (OAS) drew up the Caracas Convention on Diplomatic Asylum in 1954, though this has been ratified by only 14 of its 34 members.

In a democratic Latin America, this practice ought to be redundant. But it is not quite. Manuel Zelaya used the Brazilian embassy in Tegucigalpa to campaign against his ousting as Honduras’s president in 2009. In June Brazil granted asylum to a Bolivian senator who had sought refuge in its embassy in La Paz, claiming that his denunciations of drug-trafficking and corruption against the government of Evo Morales, an ally of Mr Correa’s, made him a target of political persecution. But it is doubtful that the drafters of the Caracas Convention had in mind its use to protect the likes of Mr Assange from indictment for sexual assault in Sweden, a country whose respect for human rights is beyond serious reproach.

A glasshouse dweller throws stones

Mr Correa’s opponents in Ecuador’s media accuse him of hypocrisy, pointing to his intolerance of criticism and lack of regard for freedom of speech at home. The same goes for his impugning of the legal process in Britain and Sweden. Mr Correa won a referendum setting up new controls on the judiciary that has allowed him to pack the courts with judges of his own liking. In July 2011, he won a libel action against an opposition columnist, Emilio Palacio. The court imposed a disproportionate penalty against Mr Palacio and three directors of El Universo, a newspaper, of three years in jail and fines totalling $40m. After an international outcry, Mr Correa pardoned the four, but only after Mr Palacio had sought asylum in Miami.

Correa’s having a laugh Mr Correa argues that the private media are controlled by businessmen intent on undermining his government. While building a state media empire, the government has recently shut down 19 radio stations and a television channel. In some cases they were in arrears with regulatory fees, but they argue that due process was not followed. On July 31st officials and police seized the computers of Vanguardia, a weekly magazine, for the second time. This time the labour ministry alleged that the magazine had failed to comply with a law requiring it to hire a disabled person. Vanguardia says the ministry refused to register the contract of a disabled staffer. A new penal code aims to stop any would-be Ecuadorean Assanges from leaking government documents. In protest, hackers hijacked government websites during Mr Correa’s recent annual speech to Congress. Providing asylum to Mr Assange “won’t change the repressive conditions facing Ecuadorean journalists who want to report critically about government policies and practices,” wrote Carlos Lauría of the Committee to Protect Journalists, a campaign group, in a blog. But Vanguardia’s editor, Juan Carlos Calderón, says that the “paradoxical” grant of asylum to Mr Assange will make it harder for Mr Correa to trample on the media in future. Graffiti sprayed on a wall in Quito reads “Assange is coming—Prepare”. Almost certainly not: “in diplomatic and legal terms, we’re at an impasse”, says Francisco Carrión, a former foreign minister. “To turn the page requires a political solution.” Mr Correa said this week that Mr Assange “could stay in the embassy indefinitely”. But he added that he was open to talks with Britain. Mr Assange’s latest lawyer, Baltasar Garzón, a Spanish former magistrate, wants Sweden to provide an explicit guarantee that it will not send Mr Assange to the United States. Such an absolute guarantee is impossible under Swedish law. A potentially damning accusation that Mr Correa applies double standards involves Alexander Barankov, a former investigator from Belarus. Mr Barankov fled in 2009 after being charged with fraud and extortion. He says the charges were trumped up after he uncovered oil smuggling by senior officials. In 2010 he was granted refugee status in Ecuador. But after Belarus’s autocratic ruler, Alexander Lukashenko, visited Ecuador last month, signing several co-operation agreements, Mr Barankov was arrested and jailed. Ecuador is considering a request from Belarus to extradite him. Mr Lukashenko is said to have guaranteed that Mr Barankov would not face the death penalty.

Mr Barankov may or may not be a criminal. But in deciding whether to extradite him, Mr Correa will reveal whether he places more faith in Sweden or Belarus, which is not known for fair trials. If or when Ecuador’s oil boom ends, its citizens may start to care more about their president’s choice of friends.