Libya's Supreme Court has overturned death sentences against five Bulgarian nurses and a Palestinian doctor, who were convicted of infecting Libyan children with HIV.

After spending nearly seven years in Libyan custody, six foreign medical workers won an appeal that annuls their death sentence. Their case will be retried in a lower court.

The five Bulgarian nurses and a Palestinian doctor were detained in 1999 with several others, and were charged with infecting 426 Libyan children with HIV.

Fifty of the infected children are reported to have died. Parents and representatives of the children protested the court's ruling.

At their trial in 2004, the six foreign medical workers were convicted and sentenced to death by firing squad.

Medical experts say the infections started before the foreign medical workers arrived, and were probably caused by poor hygiene.

The medical workers said their confessions were obtained through torture.

The judge in Sunday's ruling acknowledged problems with how Libyan authorities handled the case.

Bulgaria formerly refused to provide aid to the infected children, but on Thursday, officials announced they would help create a fund for that purpose, along with the European Union and the United States.

Bulgarian officials welcomed the ruling as a positive sign, and expressed hope for a swift resolution of the case.