San Salvador, El Salvador (CNN) -- The plea of a pregnant woman to be granted an abortion has gripped El Salvador for months: She wanted an abortion after doctors told her that her baby would not survive outside the womb and that her life was at risk.
But abortion is illegal without exceptions in El Salvador, and on Wednesday, the country's Supreme Court denied her petition.
Atttorneys for the 22-year-old woman, known only as "Beatriz," argued that the mother's life was at risk if the pregnancy was not terminated.
Ill woman at center of abortion debate in El Salvador
In a 3-1 vote, the justices ruled the risk to Beatriz's life was not imminent but a possibility in the future.
"This court finds that the rights of the mother cannot be prioritized over those of the (fetus) nor vice versa," the ruling said.
The ruling found that doctors must continue to monitor the woman and make the best medical decisions that take into account the risks to her life, and to the unborn baby, too.
Beatriz is suffering from lupus and kidney problems, and her unborn child developed without parts of the brain or skull. She asked for an abortion so that doctors could focus on saving her life, but doctors were hesitant to carry out the procedure without assurances that they wouldn't be prosecuted, her attorneys said. Doctors said they expect the baby to survive only for hours after birth.
She argued that an abortion could save her life and allow her to care for her other child, who is a year old.
Anti-abortion groups countered that abortion-rights advocates were using Beatriz as an opening to push for changes to abortion laws.
"The constitution makes it clear that life exists from the moment of conception, and anything that tries to end a life is murder," lawmaker Rodolfo Parker said after the ruling.
Women's rights groups who have held rallies in support of Beatriz said they were disappointed by the ruling and criticized the high court for taking weeks to reach a decision.
"There has to be a prudent period (to make a decision) that doesn't take practically a month and a half like we waited to have a serious analysis," said Ima Guirola of the rights group CEMUJER.
The court's decision is not the end of the Beatriz's options. Her family has said she is considering traveling outside the country to a place where an abortion can be carried out legally.
Journalist Merlin Delcid contributed to this report from San Salvador. CNN's Mariano