A gay man has won legal recognition of his common law marriage to his partner, who died two months before the U.S. Supreme Court expanded the definition of marriage to include same-sex couples.

The Pennsylvania Superior Court on Monday overturned Beaver County President Judge John D. McBride’s ruling that Michael Hunter and Stephen Carter were never legally married. Carter died in a 2013 motorcycle accident shortly before the U.S. Supreme Court struck down the Defense of Marriage Act’s definition of marriage as a union between a man and a woman.

In his appeal, Hunter argued that he and Carter had been in a relationship since 1996 and were married by common law prior to the state Legislature’s abolishment of common law marriage in 2005.

The Beaver County judge had ruled that even if they were together before the 2005 abolishment, same-sex couples in Pennsylvania did not have the right to marry until 2014. Going by the old definition of marriage, McBride denied Hunter’s petition to have his marriage recognized.

No government agency, though, opposed their common law marriage. However, Superior Court Judge H. Jeffrey Moulton wrote in the court’s opinion that both a Pennsylvania federal court ruling legalizing gay marriage in the state in 2014 and the U.S. Supreme Court’s 2015 ruling in Obergefell v. Hodges changed everything. Moulton said McBride based his ruling on law that was declared unconstitutional.

“Same-sex couples have precisely the same capacity to enter marriage contracts as do opposite-sex couples, and a court today may not rely on the now invalidated provisions of the marriage law to deny that constitutional reality,” Moulton said.

This is a developing story.