Jailed WikiLeaks founder Julian Assange appeared in a Madrid court via videolink from Britain on Friday as part of an investigation into his allegations that a Spanish firm spied on him while he lived inside the Ecuadorian embassy in London.
The case, led by Spanish judge Jose de la Mata, focuses on allegations that first cameras and then microphones were installed in the embassy between June 2017 and early 2018 by Spanish private security firm Undercover Global SL.
An Ecuador foreign ministry spokeswoman declined to comment on the case.
The recordings, said to have captured conversations between Mr Assange and his lawyers, may have been distributed to parties including "authorities from Ecuador and agents from the United States," according to court documents, which say this was done "probably on orders from US intelligence".
A CIA spokeswoman declined to comment.
"Finally, Mr Assange will be able to testify as a victim of this alleged spying plot which would have been orchestrated from the United States," said Aitor Martinez, a lawyer for the Wikileaks founder, who testified as a witness in the case.
During his testimony, Mr Assange said he was unaware that cameras installed by Undercover Global were also capturing audio and suggested the surveillance likely targeted members of his legal team, according to a spokesperson for his lawyer.
Owner and director of UC Global SL David Morales declined to say whether his company spied on Mr Assange.
"All the information is confidential and it belongs to the government of Ecuador," Mr Morales told Spanish newspaper El Pais in July. "We simply did a job."
Judge De la Mata initially detained Mr Morales in September, and then released him on bail.
Speaking outside the court in Westminster, former Ecuadorean consul in London Fidel Navraez accused Undercover Global of betraying Ecuador and Mr Assange.
"That company was contracted by Ecuador in order to protect the embassy, protect Julian Assange, protect the embassy staff ... but it is a corrupt company - we know that now," he said.
Mr Assange's legal team wants to have the firm and its founder charged with crimes including violation of privacy and attorney-client privilege, money laundering, and bribery.
The Wikileaks founder spent nearly seven years holed up in the embassy in order to avoid extradition to Sweden over allegations of rape that were dropped in November.
He was forcibly removed from the embassy in April and jailed for 50 weeks for skipping bail in Britain before the US began its extradition request. A full extradition hearing for Mr Assange, 48, is scheduled in February.
Mr Assange faces 18 counts in the United States including conspiring to hack government computers and violating an espionage law. If convicted, he could spend decades in prison.