The imprisonment of the medics has caused an international outcry
Death sentences on six foreign medics convicted of infecting Libyan children with HIV have been commuted to life in prison by Libya's top legal body.
The High Judicial Council ruling came after the families of the 438 children agreed a compensation deal reportedly worth $1m (£500,000) per child.
Talks are expected to open on Wednesday on the transfer of the six to Bulgaria.
The five Bulgarian nurses and a Palestinian doctor, who were convicted in 2004, maintain their innocence.
Libya's foreign minister said Tripoli was willing to consider the medics' transfer to Bulgaria but that it would take place in "the legal framework and political context" between the two countries.
"There is a legal co-operation agreement between Libya and Bulgaria, and we don't mind that the Bulgarian nurses and the Palestinian doctor benefit from it," Abdel-Rahman Shalqam told the Associated Press news agency.
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
He added that the conditions of the infected children and their families should be a consideration in the transfer deal.
Bulgaria's Foreign Minister Ivailo Kalfin said negotiations on the transfer of the six prisoners to Sofia would begin on Wednesday.
"This decision is a big step in the right direction... For us the case will end once they come back to Bulgaria," he said.
The Palestinian doctor has been granted Bulgarian citizenship to allow him to benefit from any transfer deal.
Libya's Supreme Court last week upheld their 2004 death sentences, placing the medics' fate with the High Judicial Council.
The council, a semi-political body, has the power to commute sentences or issue pardons.
At the weekend the medics signed a letter of request for pardon and mercy, as well as a document ruling out any further legal action against the Libyan state over the prison time they have so far served.
A spokesman for the relatives, Idriss Lagha, said that all the families had now received compensation.
The payout is reportedly coming from an international fund which the Libyan government, the European Union and other organisations are contributing to.
The medics were convicted of deliberately injecting 438 children with HIV-tainted blood. Fifty-six children have since died.
The six, who have been in prison since 1999, say they were tortured to confess.
Foreign experts say the infections started before the medics arrived at the hospital, and are more likely to have been a result of poor hygiene.
Bulgaria, its allies in the European Union, and the United States say Libya has used the case to deflect criticism from its run-down health service.
They have also suggested that not freeing the nurses could carry a diplomatic price for Libyan leader Muammar Gaddafi, who is seeking to emerge from more than three decades of diplomatic isolation.