PIERRE, S.D. — A retired South Dakota police officer asked the state's Supreme Court Tuesday to allow her to collect state retirement system survivor benefits after her wife, a former police captain, died of cancer.

An attorney for retired Rapid City officer Debra Anderson argued to the high court that South Dakota's previous ban on same-sex marriage can't be used to deny Anderson the benefits. The state said Anderson, 64, shouldn't receive survivor benefits because she and former Capt. Deb Cady weren't married before Cady retired in 2012 due to breast cancer.

Anderson and Cady had been together for many years at that point, but weren't married because it wasn't legal in South Dakota at the time. They married in 2015, when the U.S. Supreme Court legalized gay marriage nationwide, and Cady died two years later.

"The South Dakota law that forbade same-sex marriage was unconstitutional, and as a result Deb Anderson is entitled to benefits as a surviving spouse, just as she would be if she were a man," attorney James Leach said before the arguments.

Retirement system attorney Robert Anderson argued to the high court that Debra Anderson isn't entitled to survivor benefits. He said Debra Anderson is asking the court to create a marriage in 2012 when one didn't exist, arguing that the justices shouldn't engage in that type of "marriage reconstruction."

Robert Anderson contended that if Cady and Debra Anderson had gotten married in a state that allowed same-sex marriage before Cady's 2012 retirement, then "today we would not be in this courtroom."

A 1996 law passed by the South Dakota Legislature and a voter-approved 2006 constitutional amendment banned gay marriage.

According to a court document, the couple discussed getting married when Massachusetts legalized gay marriage in 2003 and hoped it would be an option for them when Iowa legalized it in 2009. That year, Cady surprised Anderson with matching rings that Anderson still wears.

"We agreed that we would marry," Anderson previously testified, according to the document. "But for us it was going to have to be when it was either recognized by the State of South Dakota, which is where we resided and worked, or by the Federal Government, you know, as a nation as a whole."

Anderson referred comment to her attorney after the Supreme Court arguments. Anderson appealed a lower court ruling against her.

Shannon Minter, legal director for the National Center for Lesbian Rights, said Anderson's case represents a relatively new issue emerging in the aftermath of the U.S. Supreme Court decision legalizing gay marriage. He said the issue is arising in a variety of legal contexts, including alimony, marital property rights and retirement benefits.

"The South Dakota Supreme Court will be one of the very first in the country to address the ... plight of same-sex couples who, you know, yearned to marry but were barred from doing so by an unconstitutional state law," Minter said.