It was going to be the largest single charitable donation in Panama's history: more than $50m (£32m) for poor children.

Wilson Lucom, a US tycoon, left most of his estate to a foundation to help the neediest people in the country where he lived until his death in 2006, aged 88.

Now, four years later, after a bitter legal battle, the fortune is going to one of Panama's most powerful dynasties – including the ambassador to Britain – and the children have been left without a cent.

Panama's supreme court declared Lucom's will void in August, it has emerged, giving the entire estate to his widow, Hilda, the ailing, octogenarian matriarch of the Arias family, which has extensive media, property and financial interests.

Her five children from a previous marriage – scions of a family which boasts former presidents as well as ministers and diplomats – are expected to inherit the money after she dies.

Critics have accused the tycoon's widow of greed and questioned the integrity of Panama's judicial system.

"That money could have helped a lot of children. If that family keeps it God will not forgive them," said Hector Avila, head of a children's charity. "In this country political and economic forces weigh more than justice."

The ruling was a triumph for the widow and her family after a bitter fight involving more than 20 legal firms, Interpol alerts and criminal charges against the lawyer representing the would-be charitable foundation. Both sides have continued trading accusations of corruption, smears and dirty tricks.

Lucom was an unlikely champion of poor children. The son of a Pennsylvania gas station attendant, he was a diplomat before marrying an automobile heiress in 1954. They settled in Florida, where he backed conservative causes and helped found the group Accuracy in Media.

In 1982, a year after his wife's death, Lucom married Hilda Piza de Arias, the former wife of Gilberto Arias, a Panamanian politician, and in the 1990s they moved to Panama. Lucom, who never had children of his own, continued propagating radical beliefs, such as nuclear strikes to deter terrorism.

His in-laws were Creole aristocrats with a colourful lineage. One member, Roberto Arias, was ambassador to Britain in the 1950s and married the British ballerina Dame Margot Fonteyn. In the 1990s the Arias family sold a 7,000-acre hacienda, Santa Monica, to Lucom.

Lucom, who was not especially close to his adult step-children, sprang a surprise upon his death. His will granted his wife a monthly stipend of $20,000 and gave her children one-off payments ranging from $50,000 to $200,000. But the big prize – the hacienda, whose value had soared to more than $50m – was to be sold off and the proceeds given to a newly created foundation for poor children.

His widow – whose son Gilberto is Panama's current ambassador to Britain – protested. She hired a prominent lawyer, Héctor Infante, who challenged the validity of the will and claimed the tycoon had been manipulated by advisers.

The widow launched a legal battle against Richard Lehman, Lucom's longtime lawyer and trustee of the would-be foundation. Lehman was charged with 15 criminal charges including negligent homicide in Lucom's death, forgery, extortion and perfidy. He and a colleague were placed on an Interpol list. Lehman said it was a smear campaign, who is based in Florida. "It's amazing what they did to me."

All charges were eventually dismissed but Lehman's conduct was criticised by a US court. An administrator appointed by a Florida court found irregularities in his handling of one Lucom bank account, and criticised him for not disclosing that he owed Lucom $500,000 at the time of his death.

Several lower courts upheld the will as reflecting Lucom's last wishes but Panama's supreme court declared it void last month, arguing that Lucom's reference to his "beloved wife" showed he really wanted her to inherit the estate, not poor children. Critics – including a former US ambassador – have in the past accused Panama's justice system of favouring the rich and powerful.

"It's a joke. They stole that money, it's that simple," said Lehman. "I'm sad and disgusted. Kids are starving and a few individuals have walked away with everything."

Infante declined a telephone interview request. Gilberto Arias, the ambassador, did not respond to interview requests.