Libya's Supreme Court has upheld death sentences imposed in 2004 on five Bulgarian nurses and a Palestinian doctor for infecting children with HIV.
The foreign medics have always insisted they are innocent
However, a mediating body is now said to have agreed a financial settlement with the children's families.
The High Judiciary Council, which can overrule the Supreme Court, is to meet on Monday to confirm, annul or amend the death penalty verdicts.
The imprisonment of the medics has caused an international outcry.
They insist they are innocent of deliberately giving tainted blood to the children at the Benghazi hospital in 1998.
A spokesman for the Libyan parents, Idriss Lagha - himself the father of one of the victims - confirmed a final deal had been reached with all the interested parties involved, including the European Union and the Libyan government.
TRIAL IN DATES
1999: 19 Bulgarian medics and a Palestinian doctor are arrested at a Benghazi hospital after an outbreak of HIV/Aids among children. 13 are later freed
May 2004: Libya convicts and sentences five Bulgarian nurses and the Palestinian doctor for infecting children with HIV. A Bulgarian doctor is freed
Dec 2005: Libyan Supreme Court overturns the convictions and orders a retrial
Dec 2006: Medics sentenced to death a second time
Feb 2007: Medics appeal to the Libyan Supreme Court
June 2007: Top EU officials hold talks in Libya to try to secure medics' release
11 July 2007: Libya's Supreme Court upholds death sentences
But the contents of the deal, reportedly brokered by the Gaddafi Foundation, remain vague.
Mr Lagha said details of the agreement will be made public in the coming hours or days.
The BBC's Rana Jawad, in Tripoli, says any financial settlement with the families of the infected children means they will drop their rights to pursue the death penalty.
Tripoli says that when it meets on Monday, the High Judiciary Council will take into account any financial compensation to the infected children's families and the amount of time already served by the prisoners.
Its decision will be final and irreversible.
Whatever the outcome, the latest developments signal a near end to this eight-year saga, our correspondent adds.
Speaking after the Supreme Court ruling, Bulgarian President Georgi Parvanov urged Libya to find a quick solution.
"Unfortunately, the court's ruling today is not a surprise. We expected the death sentences to be confirmed. We expect and insist for a swift solution by Libya's High Judicial Council to finally complete the case," he said.
The families of the infected children had previously demanded the maximum punishment.
The European Commission said it regretted the decision by Libya's Supreme Court, and the EU's External Relations Commissioner, Benita Ferrero-Waldner, said she hoped the Libyan authorities would show clemency to the medics.
In recent months, the European Union has stepped up diplomatic efforts to have the medics freed.
The United States has also been involved, with President George W Bush appealing for their release in June.
The six medics were found guilty and sentenced to death twice, first in 2004 and again in 2006 following a court appeal.
During their trial, one of the doctors who helped first isolate the HIV virus, Luc Montagnier, said the hospital epidemic began before the foreign medics started working at the hospital.
The government in Tripoli is caught between its wish to repair ties with the West and to defend its own legal system, the BBC's Eastern Europe reporter Nick Thorpe says.
Fifty-six of the 438 children infected with tainted blood at the Benghazi hospital have since died.