The wider implications weren't immediately clear, but Superior Court Judge Mary Jacobson said New Jersey has a long history of recognizing marriages that are valid where they were performed.
The state doesn't let gays marry but does allow civil unions. The state Supreme Court has ruled that gay couples have the rights to the same legal standing as married heterosexual couples.
The women — La Kia Hammond of Trenton and Kinyati Hammond of New Castle, Del. — were married in Victoria, British Columbia, in March 2004 and lived together in North East, Md. In 2005, La Kia, then 29, was found to have a terminal form of muscular dystrophy. She said doctors gave her two years to live.
About three years ago, she left Kinyati and moved with her daughter from a previous relationship to Trenton.
Now, she says, she is in love again and wants to marry before she dies. But without a divorce that's recognized in Canada, her lawyer says, she cannot wed again there.
The lawyer, Stephen Hyland, who is working on the case along with lawyers hired by the American Civil Liberties Union, said his client couldn't simply file for divorce in Canada because only residents can be granted divorces there.
The state attorney general's office had opposed the request, the first of its kind in the state, and was seeking to have the couple's marriage dissolved as if it were a civil union. Officials have not said whether the state will seek an appeal.
As more states and nations recognize gay marriage, the question of how to handle divorces is becoming more common.
Courts in a handful of states, including New York, Oklahoma, Rhode Island and Texas, have wrestled with the question in the past few years. In most cases, judges have ruled that the state would not grant the divorces because the states do not recognize same-sex marriage.
Cases like these are closely watched by advocates for and against gay marriage, partly because allowing gay couples to divorce could open the door to recognizing gay marriage.
"Divorce is part of what marriage does," said Evan Wolfson, the founder of the New York-based gay rights group Freedom to Marry.