Same-sex couples cannot get married in Maryland, but they can get divorced there, according to a decision Friday by Maryland's highest court.

In the case before the Maryland Court of Appeals, two women married legally in California sought a divorce in Prince George’s County. They were told they were not legally married in Maryland, so they cannot be legally divorced. Friday's ruling requires the state to recognize same-sex marriages that are performed in the District or in one of the six states where same-sex marriage has been legalized.

This means that same-sex couples married legally in other states “would have the same legal rights as any heterosexual couple that gets married out of state,” said state Attorney General Doug Gansler.

For example, a person cannot be required to testify against his or her spouse in court. If one spouse works for a public agency in Maryland, the other can share in the health benefits. (Private employers are subject to federal law, so they don’t have the same requirements.) And same-sex couples married legally in another state can get all the benefits of divorce, including alimony.

State law requires Maryland to recognize marriages considered valid in other states as long as the marriage is not "repugnant" to Maryland public policy or specifically prohibited by the state legislature, the ruling says.

“The standard for repugnance is high,” said University of Maryland law professor Jana Singer. “There are many statutes and government actions recently that show support for same-sex relationships,” she added, explaining that these actions mean same-sex marriage does not fly in the face of Maryland public policy.

Maryland recognizes same-sex couples’ rights in areas like health care, employment benefits — the state and some local jurisdictions already offer gay couples partner benefits — and estate planning, the court opinion described.

Unlike the majority of states where same-sex marriages cannot be legally performed, Maryland does not have any laws that specifically say the state will not recognize gay marriages performed elsewhere, which aided the court’s decision that these marriages are not repugnant. Maryland is one of five states where this is the case, according to Gansler.

There are also other examples of marriages not legal to be performed in Maryland but recognized by the state as legal. The court pointed to a case in which an uncle and his niece went to Rhode Island to get married. Though the marriage would have been a crime if performed in Maryland, the state recognized it as valid.

The ruling comes just months after Maryland Gov. Martin O'Malley signed a bill permitting same-sex couples to marry in the state. That law is set to take effect in January, though opponents have begun efforts to get it on the ballot in November.

“If the referendum overturns the law, … Maryland will recognize same-sex couples who were able to go to other states and get married but will not recognize same-sex couples who get married in Maryland,” Singer said. They would be able to get divorced in Maryland, but not married.

But state Del. Patrick McDonough, R-Harford and Baltimore counties, who is involved with the effort to get the law on the ballot, said whether the state recognizes same-sex marriages should be a matter for the legislature, not the courts.

If the law legalizing same-sex marriage is overturned in November, there would be "total inconsistency in the state law based on the fact that these non-legislative entities ... are making these legislative decisions," he said.