El Salvador's Supreme Court has ruled against allowing a woman suffering from kidney failure and lupus to terminate a pregnancy in which the foetus is given no chance of surviving.
The Central American country's laws prohibit all abortions, even when a woman's health is at risk.
At present, the woman and any doctor who terminated her pregnancy would face arrest and criminal charges.
The judges voted four to one to reject the appeal by the woman's lawyers, who argued that continuing with the pregnancy puts her life at risk.
The court said physical and psychological exams done on the woman, who is 26 weeks pregnant, by the government-run Institute of Legal Medicine found that her diseases are under control and she can continue the pregnancy.
The woman, a 22-year-old mother of one, is described as in fragile health.
She has lupus, a chronic immune disorder, and kidney failure, and medical experts have said the pregnancy is a threat to her health.
Ultrasound images, meanwhile, indicated the foetus is developing with only a brain stem, a condition known as anencephaly. Most babies born with anencephaly live only a few days.
There was no immediate reaction to the ruling, which was announced late in the day. Lawyers for the woman did not return calls.
Before the court heard arguments in the case two weeks ago, the government's Health Ministry said it supported the woman's request for an abortion on health grounds.
But the government's Legal Medicine Institute argued the pregnancy should be allowed to continue.
A medical committee at the maternity hospital where the woman has been treated said the baby wouldn't survive and recommended terminating the pregnancy, saying the woman's health "will certainly get worse as the pregnancy advances."
El Salvador's attorney general for human rights, Oscar Luna, said earlier that "in reality, what should prevail above all are human rights - in this case, the right to life."
The Yes to Life Foundation, a Salvadoran group that opposes abortion, said the woman should wait to see if there were any medical procedures available to induce an early delivery.
Regina de Cardenal, the head of the group, said the case was being used to press for legalised abortion in El Salvador.