The international wrangle over the future of Edward Snowden took a further twist when Ecuador declared it had found a listening device in its London embassy and threatened to reveal who had planted it.

In another day of drama and diplomatic indignation, Ricardo Patiño, Ecuador's foreign minister, said the device had been discovered a fortnight ago when he had been in the UK to discuss another fugitive, the WikiLeaks founder Julian Assange.

Patiño said the hidden microphone had been found in the office of Ecuador's ambassador, Ana Alban, and he condemned the development as a "loss of international ethics".

If the claim proves true, the spotlight is likely to fall on Britain's intelligence agencies. MI5 would normally be tasked with concealing listening devices in buildings such as embassies in the UK, though MI6 could also seek authorisation.

This could not be done without ministers knowing. Theresa May, the home secretary, is responsible for the conduct of MI5 and deals with its most sensitive applications.

If the agency had planted the bug, her authority would have been needed. Such warrants have to be renewed at regular intervals as part of Britain's legal framework for spying activity.

Whitehall sources refused to be drawn on the bugging issue, saying they could "neither confirm nor deny" whether UK intelligence agencies had been involved.

Patiño's intervention came as leaders across Latin America condemned the treatment of the Bolivian president, Evo Morales, whose plane was forced to land in Austria amid suspicions that it might be carrying Snowden, the US intelligence analyst. Morales was on his way back home after a trip toMoscow, where Snowden has been stranded since he left Hong Kong more than a week ago.

Bolivia accused Austria of "kidnapping" the president, who was kept in Vienna for 14 hours while his plane was searched.

France, Portugal and Spain were all said to have refused permission for the president's plane to enter their airspace, raising suspicions about the pressure being exerted by the US.

The episode stoked anger in Latin America, where there is growing disquiet over the way in which the US has attempted to pressure countries into refusing to offer Snowden sanctuary.

Ecuador has said it will not consider an application for his asylum unless he is in the country. But the assistance that it gave to Assange, who has been staying at the country's at the Ecuadorian embassy in London for more than a year, has made it a focus of American and British diplomatic pressure.

WikiLeaks has been trying to help Snowden evade US law enforcement officials, who want him to face trial on espionage charges for leaking details about the country's top-secret surveillance programmes.

Though Patiño gave few details, it would appear that the bug was discovered on June 17 – a week before Snowden left Hong Kong. At the time, Assange and other members of WikiLeaks were providing the former intelligence analyst with legal and logistical help.

At a press conference in Quito, Patiño said: "We regret to inform you that in our embassy in London we have found a hidden microphone. I didn't report this at the time because we didn't want the theme of our visit to London to be confused with this matter. Furthermore, we first wanted to ascertain with precision what could be the origin of this interception device in the office of our ambassador."

He described the discovery of the device as "another instance of a loss of ethics at the international level in relations between governments".

Patiño was in the UK last month to talk to Assange, who was granted asylum by Ecuador to prevent him being extradited to Sweden, where he has been accused of sexual assault and rape.

He denies the allegations, and claims that if he went to Sweden, he could be extradited from there to the US to face potential charges over the release of thousands of confidential US documents on the WikiLeaks website.

During his visit, Patiño met the foreign secretary William Hague, and denounced Assange's captivity as "totally unjust".

The affair has strained the relationship between Ecuador and the UK, and infuriated Washington, which was embarrassed by the mass disclosure of diplomatic cables and correspondence provided to Wikileaks by Bradley Manning.

Though the discovery of a bug in the Ecuadorean embassy could prove awkward for the UK, there is nothing illegal about so-called "intrusive surveillance".

There are provisions in the Regulation of Investigatory Powers Act (RIPA) for the police and intelligence agencies to bug buildings or cars. MI5 and MI6 can also break into buildings to place surveillance devices under powers provided by the Intelligence Services Act.

To obtain ministerial approval, the agencies have to show that there is a requirement to place the device. The broad and ill-defined categories include protecting national security, preventing or detecting crime and safeguarding the economic wellbeing of the UK.In a speech today, the security minister, James Brokenshire, dismissed concerns about the extent of UK surveillance.

"Anyone reading the papers over the past year could be forgiven for thinking that the main threat to our freedoms in fact comes from those working so hard to protect the public across a range of national security issues. I know that this isn't true. You know that this isn't true. And most of the people in this country know that this isn't true. But it is right that we should be challenged and that we should challenge ourselves."