A judge in Barcelona is allowing a woman to undergo in vitro fertilization with her dead husband’s sperm, even as the prosecution insists it is not possible to ascertain the man would have consented if he lived.

Also, the prosecution said, such a treatment “is not convenient" for a woman who is single.

The facts go back to 2014, when the man decided to freeze sperm before undergoing a very aggressive cancer treatment that could make him sterile. After the treatment ended, the couple took the first steps to start in vitro fertilization, but after a few months the man worsened and later died.

They got married in the hospital just a day before his death.

The woman has since tried to get pregnant four times but had to stop when the clinic demanded a judicial order because a year had passed — according to Spanish law, genetic material of a deceased person can be used within 12 months after the death.

However, the prosecution has based its case on moral grounds more than legal ones.

"[The prosecutor] suggests that if he were alive he could have divorced or would not have wanted children. She makes a series of baseless claims that are not legal. (...) If this were so, wills would never be valid," the lawyer for the woman told ABC newspaper.

The lawyer said that as “universal heiress” her client has the right to decide what to do with this genetic material. “We would be before the absurdity that she cannot use (this genetic material) for herself but could give it to another woman,” she claimed.

The widow said that when he was already very sick her husband signed a paper agreeing to have her conceive a child with his sperm.