LONDON -- Julian Assange's conversations in the latter part of his 7-year stay at the Ecuadorian Embassy in London were systematically bugged, even in the toilet, a London court heard Wednesday.

In written statements at Assange's extradition hearing, two anonymous witnesses who worked for a Spanish firm with a security contract at the embassy said the WikiLeaks founder faced an intensifying bugging operation from 2017 onwards after Donald Trump became U.S. president.

Judge Vanessa Baraitser on Tuesday granted the two witnesses anonymity amid fears for their safety. Lawyers acting on behalf of the U.S. government did not contest the submission of the anonymous statements but said they were largely irrelevant to the matter under consideration in London's Old Bailey court.

The two witnesses alleged that David Morales, the director of Spanish security firm Undercover Global, switched to "the dark side" and had instructed the installation of cameras with sophisticated audio capabilities to secretly record Assange's meetings at the embassy, particularly those with his lawyers.

Assange lived in the embassy for seven years from 2012 after seeking refuge there while fearing his potential extradition to the U.S. He was evicted in April 2019 and has been in a London prison since.

The anonymous witnesses both claimed that Morales said the surveillance was initiated at the behest of "our American friends" and that he had been handsomely rewarded.

One of the witnesses said Morales travelled to Las Vegas around July 2016 to showcase the security firm and subsequently obtained a "flashy contract" with the Las Vegas Sands, which was owned by Sheldon Adelson, a wealthy associate of Trump's.

"After returning from one of his trips to the United States, David Morales gathered all the workers in the office in Jerez and told us that `We have moved up and from now on we will be playing in the big league,"' the witness said.

The other anonymous witness, who was employed as an IT expert from 2015, alleged that while in Jerez, the city in southern Spain where UC Global's had its headquarters, Morales had said in December 2017 that "the Americans were desperate." The witness said a suggestion was made that "more extreme measures should be employed against the `guest' to put an end to the situation of Assange's permanence in the embassy."

Specifically, the witness said the idea was raised for the door to the embassy being left open, "which would allow the argument that this had been an accidental mistake, which would allow persons to enter from outside the embassy and kidnap the asylee." There was, the witness claimed, even a suggestion that Assange could be poisoned.

"All of these suggestions Morales said were under consideration during his dealing with his contacts in the United States," the witness said.

The witness also alleged that Morales had asked him soon after to install a microphone in an extinguisher in an embassy meeting room, as well as in a toilet where Assange had been holding meetings due to concern he was the target of espionage.

"I used a nearby socket to conceal a microphone in a cable in the toilet in the back of the embassy," the witness said. "This was never removed, and may still be there."

U.S. prosecutors have indicted the 49-year-old Assange on 17 espionage charges and one charge of computer misuse over WikiLeaks' publication of secret American military documents a decade ago. The charges carry a maximum sentence of 175 years in prison.

Assange's defence team says he is entitled to First Amendment protections for the publication of leaked documents that exposed U.S. military wrongdoing in Iraq and Afghanistan. They have also said he is suffering from wide-ranging mental health issues, including suicidal tendencies, that could be exacerbated if he ends up in inhospitable prison conditions in the U.S.

Assange's extradition hearing, which was delayed by the coronavirus pandemic, is due to end this week.