PARIS - The Libyan Supreme Court on Sunday overturned the convictions of five Bulgarian nurses and a Palestinian doctor who had been sentenced to death on charges of infecting hundreds of Libyan children with H.I.V. The politically charged case was sent back to a lower court for a retrial.

The action, which came on the heels of an international agreement to establish a fund that will pay for the children's medical care, raised hopes that the medical workers might eventually be freed.

"The court has accepted the appeal of the Bulgarian nurses and ordered that a new trial take place at the criminal court of Benghazi," the Supreme Court's president, Ali al-Alus, told Agence France-Presse, referring to the coastal city, Libya's second largest, where the infections took place.

The Libyan justice minister, Ali Hasnawi, told the news agency that a new trial would be held in one month under new judges.

The five nurses and the doctor were jailed in 1999 and later convicted of infecting 426 children with H.I.V., the virus that causes AIDS. Last year, they were sentenced to death by firing squad.

There was international condemnation of the death sentences.

Lawyers for the Bulgarians and the Palestinian have contended that the defendants were tortured to extract confessions. About 50 of the infected children have died.

Human rights groups contend that the medical workers are scapegoats and that the cause of the infections was unsanitary conditions at the hospital. AIDS experts have said the outbreak probably occurred before the nurses began working there.

There originally were seven defendants, but one of them, Zdravko Georgiev, a Bulgarian physician, has served his four-year sentence.

The Supreme Court accepted the six defendants' appeals against the lower court ruling on both substance and procedure, according to Reuters. The decision came two days after an announcement that the United States, Britain and the European Union had joined Bulgaria in agreeing to set up the International Benghazi Families Support Fund to finance the children's medical care.

The size of the fund was not disclosed. However, in announcing the agreement to create the fund, a Bulgarian Foreign Ministry spokesman insisted that it did not constitute compensation and said that his government continued to believe the nurses were innocent.

On Sunday, the spokesman, Dimitar Tsanchev, said that short of freeing the nurses, the ruling was the second-best possible outcome.

"We hope this new trial won't take such a long time as the first one," Mr. Tsanchev said, adding that the Bulgarians are exhausted "physically and psychologically" after close to seven years in prison.

A defense lawyer, Othman al-Bezenti, said: "The verdict reflects the evidence and facts that we have presented, that all the previous measures were null and void and that the confessions were made illegally."

But a spokesman for many of the families, Ramdane Fitouri, told Reuters that the defendants could still be found guilty and sentenced to death in a new trial.

Bulgaria had rejected Libyan suggestions of paying $10 million in compensation for each infected child, the same amount that Libya agreed to pay each of the families of the 270 people killed in the bombing of Pan Am Flight 103 over Lockerbie, Scotland, in 1988, for which Libya has accepted responsibility.

Libya made the agreement for compensation in the Pan Am case as part of the effort by the Libyan leader, Col. Muammar el-Qaddafi, to repair relations with the West. "I'm convinced the case is not so much judicial as political," said Vladimir Chukov of the Arabic Studies department at Sofia University, who has followed the workers' case.

He said there had been talk of extraditing the nurses to serve their sentences in Bulgaria, but that would depend on commuting the sentences to life imprisonment.

Matthew Brunwassercontributed reporting from Sofia, Bulgaria, for this article.