MADRID — Jailed WikiLeaks founder Julian Assange appeared in a Madrid court via videolink from the U.K. 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 S.L.

An Ecuador foreign ministry spokeswoman declined to comment on the case.

The recordings, said to have captured conversations between 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 U.S. 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 Assange, who testified as a witness in the case.

During his testimony, Assange, 48, 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 S.L. David Morales declined to say whether his company spied on Assange. "All the information is confidential and it belongs to the government of Ecuador," Morales told El Pais in July. "We simply did a job."

Judge De la Mata initially detained 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 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.

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 there in April and jailed for 50 weeks for skipping bail in Britain before the U.S. began its extradition request. A full extradition hearing for Assange is scheduled in February.

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.