Virginia Attorney General Mark Herring (D) at an event in Leesburg in October. (Ricky Carioti/The Washington Post)

Virginia’s attorney general has issued an official opinion that a state law prohibiting the concealment of dead bodies does not apply to stillborn fetuses, a move that will hearten supporters of abortion rights and dismay opponents.

The opinion comes after the Virginia Court of Appeals recently upheld the controversial conviction of a southern Virginia woman who was tried and found guilty under the statute for disposing of a fetus that had died in her womb and led to a miscarriage. She was sentenced to five months in jail.

Attorney General Mark R. Herring, a Democrat, acknowledged that his office had erred in arguing in a brief for the appeals court that the woman’s conviction should be upheld. He disagreed with the decision, his office said, but the case was never brought to his attention. The office handles about 1,000 appeals a year.

Katherine Dellis, 26, of Rocky Mount, Va., had appealed her conviction on the grounds that the “fetus was never alive” so it “cannot be dead.”

The handling of fetal remains has been a heated front in the abortion debate in recent years. Supporters and opponents of abortion rights had taken an interest in Dellis’s case, even though it did not involve an abortion.

“Virginia law does not criminalize women who have a miscarriage, and as attorney general I have an obligation to clarify any ambiguity and correct any impression or statement to the contrary,” Herring wrote in a statement.

Herring issued his opinion the day after the deadline expired for Dellis to appeal her case to Virginia’s Supreme Court. No appeal was filed, and Dellis and her attorney have not responded to requests for comment.

Herring’s office said he issued the “official advisory opinion,” which courts can draw on in deciding cases, at the request of Gov. Ralph Northam, also a Democrat. The Virginia Court of Appeals decision on Dellis’s case in late April was unpublished, meaning it does not set precedent in Virginia.

In his opinion, Herring wrote that the state legislature never intended the statute to apply to the remains of stillborn babies, because elsewhere in the same statute and in other sections of the Virginia Code, laws specifically distinguish between a dead body and a fetus.

In its ruling, the Virginia Court of Appeals wrote that Dellis’s placenta separated from the wall of her womb in February 2016, triggering a miscarriage. Dellis passed out in her bathroom and awoke to find the stillborn fetus on the bathroom floor next to her.

Dellis then cut the umbilical cord, wrapped the fetus in a bathmat and disposed of it in a garbage can, according to the ruling. Dellis eventually sought medical care, and a doctor alerted authorities after becoming concerned.

The remains were found in a dumpster, and a medical examiner performed an autopsy, finding the fetus was 30 to 32 weeks old, according to the ruling. A fetus of that age can be viable with the right care, but the examiner found that the fetus’s lungs had never been exposed to air and that it had died in the womb up to three days before the miscarriage.