The Utah law that governs gestational surrogacy agreements should apply equally to all married couples, or be deemed unconstitutional because it bars gay men from having a biological child.

That’s the argument made before the Utah Supreme Court on Tuesday by attorneys for a male married couple whose surrogacy petition was denied by a St. George judge in 2016.

Fifth District Judge Jeffery C. Wilcox said he believed he had no choice but to follow the language of Utah’s law, which requires medical proof that an intended “mother” is unable to conceive or carry a child.

That works for married heterosexual couples or lesbians, but not for married gay men.

The case is the first to challenge the surrogacy law on the basis of gender since the 2015 U.S. Supreme Court ruling that legalized gay unions nationally, granting same-sex couples all of the same rights as heterosexual couples, attorney Edwin Wall said.

Wall represents the prospective parents Jon and Noel, who want the justices to overturn the district court ruling and order Wilcox to approve their surrogacy petition.

On Tuesday, Wall told the court there are two routes to a decision: Find the statute discriminatory, and therefore unconstitutional, or direct the courts to read the law as gender neutral, despite its references to a “mother.”

That’s what most judges in Utah have done in past rulings that have allowed male married couples to pursue their biologically-related families though surrogacy.

Justice Thomas Lee questioned if a gender-neutral reading of the law — which is possible under Utah law — would be enough to settle the issue.

They also wondered why the Utah attorney general’s office, which typically defends Utah law, was not defending the surrogacy law.

State attorneys elected not to do so, Wall explained, and agree that a gender-neutral reading of the law is appropriate.

If the court disagrees, Justice Lee noted, that leaves only a constitutional argument on which to hang a solution.

“It’s a big thing to strike down a statute based on constitutional grounds,” he said.

Wall said he and the state agree that the constitutional questions can be avoided by a finding that the statute is gender neutral.

Justice John Pearce wasn’t entirely convinced and questioned whether a law written well before the legalization of gay marriage could be read to be retroactively neutral.

“I think we have to decide this on constitutional grounds,” he said.

Wall also told the court he saw no need to strike down Utah’s surrogacy law in its entirety. Aside from the gender discrimination issue, the law provides a well-structured path for surrogacy agreements that offer good protections for both intended parents and surrogates, he said.

Justices took the matter under advisement and will issue a ruling at a later date.

No matter how the court decides all Utah families will benefit from the courts ruling, Wall said after the hearing.

“If they find it unconstitutional or they read it as gender-neutral, the surrogacy law in Utah will go forward as it has,” he said. “The real problem is if Utah’s law is discriminatory and says that same-sex male couples cannot have children. That’s the barrier we are trying to overcome.”