If you wanted to use your late husband's frozen sperm to have a baby, you would need his written permission under legislation that appears poised for approval in the Maryland General Assembly.

The House and Senate have both passed bills that would make it illegal to use a dead person's preserved genetic material to reproduce without the notarized, written agreement of the donor.

The legislation seeks to bring clarity to an area of the law that has been murky since the first test-tube babies were conceived. The question of how the law should treat children conceived after a parent's death has sowed confusion in courts and legislatures since the practice of in-vitro fertilization achieved its first successes in the late 1970s.

Just this week, such a case came before the U.S. Supreme Court, where justices weighed the question of whether twins conceived with frozen sperm and born 18 months after their father's death were eligible for Social Security survivor's benefits. A federal appeals court said yes, the administration said no, and the Supreme Court appeared divided on the issue.

"It's a mess," said Justice Elena Kagan.

The Maryland legislation also deals with the tricky issue of the inheritance rights of children conceived after the death of one of their biological parents — a question that led to a proliferation of inconsistent court opinions around the country. Under the bill, a child born within two years of a biological parent's death could inherit, but only with that parent's consent.

Under current Maryland law, a child must have been conceived before a parent's death to inherit.

The bills passed after some initial skepticism about whether the General Assembly was venturing into an area where it didn't belong. The legislation's title alone, "Health — General — Posthumous Use of Donor Sperm and Eggs," was off-putting to some.

But Del. Joseline A. Pena-Melnyk, a Prince George's Democrat who sponsored the House proposal, and Sen. Dolores G. Kelley, a Baltimore County Democrat who sponsored the bill in the Senate, persuaded their colleagues that Maryland was long overdue to impose some order in what has become a biological jumble.

"Nobody knows what's enforceable, what's conscionable or what makes sense," Kelley said.

Gov. Martin O'Malley's administration has not studied the issue yet. The two bills must be reconciled before one can go to the governor for his signature, but there appears to be no fundamental disagreement between the two chambers.

"I think we'll be able to work it out," said Pena-Melnyk.

Experts in law and bioethics said it sounds as if the Maryland legislature is on the right track on a sensitive subject.

Charles P. Kindregan, a professor at the Suffolk University Law School in Boston, said the topic is "political dynamite" for lawmakers.

"No American politician wants to be accused of supporting people having babies after they're dead," he said.

Kindregan said there's been a lot of discussion about the issues raised by posthumous conception in legal circles, but not much in the way of actual legislation. He said posthumous conception has been around since sperm were first successfully frozen in the 1950s, but he said the field really took off after in-vitro fertilization was developed.

Until recent years, he said, most of the cases centered on the use of cryo-preserved sperm, but more recently scientists have improved their techniques for freezing eggs that can later be fertilized and implanted in the donor or a surrogate.

Kindregan said the requirement of written consent is a wise move.

"Nobody should be forced to become a parent after they're dead," he said.