WASHINGTON — The U.S. Supreme Court ruled Monday that Arkansas authorities must list the names of both same-sex parents on their child's birth certificate.

The court ruled 6-3 in favor of two married same-sex couples who conceived their children through anonymous sperm donations. They sued after the state said it would put only the name of the birth mother on the birth certificate but not her female spouse.

The court said Arkansas has chosen "to make its birth certificates more than a marker of biological relationships: the state uses those certificates to give married parents a form of legal recognition to unmarried parents."

People gather outside the Supreme Court in Washington on Monday. Jim Lo Scalzo / EPA

Based on the Supreme Court's earlier decision on same-sex marriage, the court said, Arkansas cannot deny married same-sex couples that recognition.

Justice Neil Gorsuch wrote a dissent, joined by Clarence Thomas and Samuel Alito.

The Arkansas Supreme Court deemed the refusal proper, reasoning that the spouse was not a biological parent. It said the U.S. Supreme Court's 2015 decision ending state bans on same-sex marriage does not require equal treatment in other contexts.

Related: Arkansas Supreme Court Deals Blow to Same-Sex Parents

But the challengers said the state treated same-sex and opposite-sex spouses differently. A mother's husband is listed on a birth certificate, they said, regardless of whether he is the child's biological father. When a married couple uses donor insemination, the resulting child is "deemed the natural child" of the woman's husband. And when a child is adopted, a new birth certificate is issued that names the adoptive couple as the child's legal parents.

When it comes to same-sex spouses, the state's refusal to list both of them on the birth certificate "causes those children to suffer the stigma of knowing their families are somehow lesser," which is what the Supreme Court sought to avoid in ending bans on same-sex marriage, said Douglas Hallward-Driemeier, a Washington, DC lawyer representing the challengers.

If the Arkansas policy is allowed to stand, he said, it would allow states "to once again relegate same-sex couples and their families to the stigma, injury, and inequality of second-their status."

But the state said its policy is intended to reflect the actual sources of a child's birth, not the legal rights of the parents. In cases of adoption, for example, a revised birth certificate lists the adoptive couple as the parents, but the original birth certificate is maintained under seal.

The state's system "is designed to ensure — with very narrow exceptions — that an original birth certificate reflects a child's biological parentage," the state said in papers filed with the Supreme Court.