For nearly five years, James Spellman has been fighting with D.C. courts to get his same-sex marriage affirmed by the court as part of a dispute over his deceased partner’s estate. (Marvin Joseph/The Washington Post)

They met working out at the Rhode Island Avenue YMCA downtown in 1993. James Spellman, a financial services consultant, saw Michael Kelly and invited him for coffee. By the next year, their friendship had grown into a romance.

Kelly moved into Spellman’s spacious three-story rowhouse just off Logan Circle and, for nearly 19 years, they lived as a couple. They vacationed together at Kelly’s house in Rehoboth Beach, Del. They hosted parties together, accompanied each other to family events and jointly sent out hundreds of Christmas cards each year.

After Kelly’s death from cancer in 2013, the nature of their relationship became the subject of a long-running court case. Kelly, a mortgage banker, had written a will before he met Spellman, leaving his nearly $1 million estate to his four siblings. Spellman, arguing that he had spousal rights to the estate, petitioned the court to recognize his partnership with Kelly as a common-law marriage.

Last month, after Kelly’s siblings dropped their opposition, a D.C. Superior Court judge ruled that Spellman and Kelly had been legally married.

“I wanted my rights respected in the estate,” Spellman, 59, said recently from his Northwest Washington home. “I had to fight for 20 years of my life. This case was about honoring and respecting our relationship.”

A photograph of Michael Kelly (left) and James Spellman. (FAMILY PHOTO)

The case is among the first involving the validation of ­common-law same-sex marriage, legal experts said.

“There hasn’t been a case like this before,” said Spellman’s attorney, Ugo Colella. “We had to prove they, like any couple, even a homosexual couple, are the same. They are not different from heterosexual couples.”

Eileen Boland, Kelly’s sister, said that for the siblings, the court battle was about what they think their brother wanted: to use his estate to help take care of her, their other siblings and their children.

“This is not one of those cases when someone dies, family members come out of the woodwork seeking money,” she said.

Colella said the case should serve as a cautionary tale for anyone — in a marriage, common-law marriage or even single — who doesn’t have a will or any legal document at the time of their death. In this case, Spellman unwittingly emerged as an advocate for same-sex common-law marriages.

At the heart of the issue was that Kelly prepared his last will and testament in 1990 and did not update it. He filed it in Delaware, where he lived at the time and which, unlike the District, does not recognize common-law marriage but does recognize same-sex marriage.

The way Spellman saw it, it was clear to those around them that he and Kelly considered themselves married. Sitting near a dining room table stacked with books and papers, Spellman jokingly refers to himself as the Oscar Madison of “The Odd Couple” while Kelly, who liked things neat and in order, was the Felix Unger.

“Everyone knew we were a couple. Michael’s family knew we were a committed, married couple,” Spellman said.

Kelly’s family argued that Spellman wasn’t in a close enough relationship with their brother to qualify as a widower. Kelly’s brother-in-law was named executor and initially denied Spellman’s claim to the estate. Spellman received an email from Kelly’s executor that said, “You are not recognized as a spouse.”

Boland said her brother never referred to Spellman as his husband or spouse.

“I never heard my brother say he was married. Ever,” she said. Boland referred to her brother’s Facebook profile, where he listed himself as “in a relationship” but never “married,” she said. She noted that her brother’s monthly retirement statements until his death listed his siblings as his beneficiaries, not Spellman.

“This is not about being against homosexuals or gay marriage,” she said. “We are far from that. We are just trying to honor my brother’s wishes upon his death.”

As part of their claim, the Bolands argued that the District had no jurisdiction in the case and that the case should be settled only by a court in Delaware, because that is where the will was filed. In 2014, a D.C. Superior Court judge agreed with the Bolands and determined that the District did not have jurisdiction over the case.

But last year, the D.C. Court of Appeals overturned that decision and determined that Kelly was indeed a resident of the District based on his job in the city, a second home he bought in Washington and the house he shared with Spellman for 19 years. The court reinstated Spellman’s lawsuit.

This year, Kelly’s family agreed to settle with Spellman. That led to the judge’s ruling last month confirming Spellman and Kelly as legally married.

“We just couldn’t afford the legal bills to keep going. It’s been difficult,” Boland said.

As part of the settlement, the Bolands agreed to transfer $625,000 to Spellman and to allow Spellman to be buried with Kelly’s remains and his name added to the plot deed upon his death.

Spellman and Boland do agree on one thing: The past four years have taken a toll on them.

“This has been a very hard and long battle that leaves you with open sores that are going to take time to heal,” Spellman said. “But I have a wonderful support network. I will be fine.”