FROM ex-president Ricardo Martinelli’s plush 43rd-floor offices overlooking the shorefront of Panama City, the view is good. Below is a Ferrari distributor; nearby are flamboyant skyscrapers, such as a twisted green one known as the “Screw”, which sprouted during his 2009-14 tenure. In those five years, Panama’s growth averaged a blistering 8%, the best in Latin America, though debt also ballooned. A supermarket millionaire, Mr Martinelli touted his country as the Latin Singapore.

Those who championed him as a pro-business alternative to left-wing zealots like Hugo Chávez of Venezuela are thinking again. Seven months after stepping down from office, he has left the country on his private jet, amid accusations that his government ran a corruption and political-espionage racket. He denies wrongdoing.

In January, the Supreme Court voted to launch an investigation into his role in a corruption case involving a $45m programme to deliver dried food to poor schoolchildren. On February 3rd the prosecutor’s office said that 44 people had testified as either victims or witnesses in a wire-tapping scandal. Accusations against Mr Martinelli by at least five people have been forwarded to the Supreme Court, which handles high-profile political cases.

Mr Martinelli says he is the victim of a vendetta by Juan Carlos Varela, his former vice-president, who succeeded him as president. One of Mr Martinelli’s lawyers, Carlos Carrillo, says that before carrying out the investigation the Supreme Court must persuade the Central American Parliament (a do-nothing body of which his client is a member) to lift his immunity. He says Mr Martinelli is free to remain outside Panama while the court investigates.

The allegations, however, are the latest turn in a downward spiral that began when Mr Martinelli’s handpicked candidate unexpectedly lost to Mr Varela in a presidential election last May. At the time, Mr Martinelli’s supporters dominated the National Assembly, the Supreme Court, the attorney-general’s office and the comptroller-general’s office—that is, almost all the centres of power in Panama except the electoral tribunal. His hold on the Supreme Court weakened when one of his appointees was suspended for amassing inexplicable wealth.

On winning the election, Mr Varela, jettisoned from Mr Martinelli’s government three years earlier, vowed to look into the corruption allegations. His aides said they expected the first targets to be the massive infrastructure projects that were the hallmark of the former administration. Instead, the first allegations emerged from an inconspicuous anti-poverty agency based in a townhouse next to the presidential office. Contracts worth $1.2 billion are under scrutiny. Two of its former directors have been arrested. One, Giacomo Tamburrelli, has twice testified to prosecutors about the dried-food programme, allegedly implicating Mr Martinelli.

Compounding the ex-president’s woes, last month prosecutors arrested two former members of his national-security agency on charges relating to the political-espionage scandal. Álvaro Alemán, Mr Varela’s chief of staff, says around 150 political and other leaders, including the archbishop of Panama, are believed to have had their phones and other communication devices tapped, based on dossiers and hard disks obtained by investigators. On February 2nd, Juan Carlos Navarro, a former presidential candidate, issued an affidavit alleging that his emails and cellular phone were bugged during the campaign, as were those of his staff. He accused Mr Martinelli of racketeering. “This was a massive, illegal spying operation,” he says.

Mr Martinelli’s spokesman, Luis Eduardo Camacho, says the evidence in the spying case is thin. But Panamanians are losing faith in the mercurial leader who once charmed them with his sharp-tongued charisma (one former fan hums a tune by a Panamanian singer, Rubén Blades: “You can see their faces, but not their hearts”).

Abroad, his backers have gone quiet. One long-standing critic, Juan Carlos Hidalgo of the Cato Institute, a Washington-based think-tank, recalls how right-wing Americans used to urge him not to bash Mr Martinelli because he was “one of us”—a Chávez foe who presided over a growth miracle. Now he is dismissed as just another tarnished Latin American populist.