MIAMI — The former president of Panama will face a federal magistrate judge in Miami on Tuesday, in a plea to stay out of jail while he fights extradition on charges that he “commandeered” sophisticated wiretapping gear to listen in on political enemies, business rivals and even a mistress.
Ricardo A. Martinelli, 65, who governed Panama from 2009 until 2014, was arrested last week in Coral Gables, Fla., on illegal surveillance and embezzlement charges. Mr. Martinelli moved to South Florida shortly after his presidency ended and requested political asylum, saying that the new president had lodged a politically motivated case against him.
Panama wants him back.
But for as much as Tuesday’s bail hearing will cover topics like flight risk and the legal complexities of international extradition treaties, it is also expected to offer a view of the unorthodox methods that governments use to keep track of their foes.
Prosecutors say Mr. Martinelli diverted $13.4 million meant for social programs for the poor to pay for software that allowed him to hack into cellphones. He is accused of running a stealth national security operation to keep an eye on dozens of business competitors, opposition lawmakers and union activists to glean embarrassing and compromising information on them.
The more salacious findings wound up on YouTube, according to an affidavit filed by a former Panamanian national security analyst.
The spyware equipment Mr. Martinelli is accused of using, Pegasus, uses malicious links in misleading text messages to infiltrate cellphones to monitor emails, contacts and text messages. Lawmakers were taped having sex. One was recorded being accused by her husband of having an extramarital affair.
Other countries are believed to have abused the spyware as well. In Mexico, at least three federal agencies have purchased about $80 million worth of spyware created by an Israeli cyberarms manufacturer.
The company that makes the software, the NSO Group, says it sells the tool exclusively to governments, with an explicit agreement that it be used only against terrorists, drug cartels and criminal groups. The advanced spyware bought by the Mexican government was used to target Mexico’s most prominent human rights defenders, journalists and anti-corruption activists, according to an investigation by The New York Times published on Monday.
“It could remotely control the microphone and the camera on certain telephone models,” Ismael Pitti, a former national security analyst in Panama who admitted participating in the scheme, said in an affidavit filed in United States District Court in Miami. “With these capabilities, we could obtain photographs and record ‘background audio,’ in other words, conversations of people close to the telephone.”
But Mr. Pitti’s former boss at the National Security Council, Ronny Rodríguez, submitted an affidavit disputing the accusations and saying that the new administration in Panama had offered him a job in Washington, D.C. if he incriminated the former president.
Because the equipment disappeared from where it had been secretly stored and used, and the server taken to Mr. Martinelli’s private office, the former president was also charged with embezzlement by misappropriation, prosecutors said.
The case also has a political back story, defense lawyers say.
The president of Panama, Juan Carlos Varela, had been chosen to be Mr. Martinelli’s vice president and foreign minister. Mr. Varela was from a different political party, but the ticket was meant to be a coalition government.
Mr. Martinelli said he had to fire Mr. Varela from his foreign minister post, because he was caught receiving bribes from consulates, according to court papers.
But in 2014, Mr. Varela himself won the presidency. His government began the inquiry against Mr. Martinelli, and in late 2015, ordered his arrest.
But days before a warrant was issued, Mr. Martinelli fled the country.
Mr. Martinelli was not arrested until this month, shortly after he announced his candidacy for president on Twitter. The bail hearing will take place just a day after Mr. Varela visited the White House, underscoring the political undertones the case has taken, the defense lawyers said.
“This may be the only extradition case in history where the country seeking extradition is being led by a man who is not only a political opponent of the defendant but was publicly and notoriously fired by him,” Mr. Martinelli’s lawyers, Marcos D. Jiménez and John R. Byrne, wrote in a motion filed Monday.
They argue that not only is the former president not guilty of the accusations leveled against him, but the charges are not offenses for which one can be extradited.
The extradition treaty between the United States and Panama does not cover wiretapping, because the treaty is about 100 years old and such a crime did not then exist, Panama’s vice president, Isabel Saint Malo, told the Council on Foreign Relations last year.
She also said the process could get complicated because Mr. Martinelli is a suspect in other corruption cases. If he is extradited on the surveillance case, that could prevent Panama from prosecuting him for other charges, she said.
“I believe it’s almost 10 cases that are in the Supreme Court regarding Mr. Martinelli right now,” she said to the council. “And most of them are a lot more serious than listening in to conversations, which is serious enough.”
Defense lawyers said Mr. Martinelli has immunity as a former president and as a current member of the Central American Parliament. They have proposed that he be released on $5 million bond and be allowed to remain under house arrest with electronic monitoring and 24-hour guarding of his home.
The United States Attorney’s Office submitted a motion urging the court to keep Mr. Martinelli in jail until the extradition case is decided. He faces 21 years in prison and is a flight risk, prosecutors said.
The owner of a chain of supermarkets, Mr. Martinelli has a plane and two helicopters and “has amassed an astounding amount of wealth, wealth that would facilitate an easy escape to a third country and sustain him and his family in exile for decades,” prosecutors said.