Gay couples barred from getting married in Massachusetts because they are from out of state said they will appeal a judge's ruling that denied their request to halt enforcement of the 1913 law being used to block their unions.

The law, which some say was originally written to block interracial couples from marrying, denies out-of-state couples the right to marry in Massachusetts if their union would be illegal in their home state. Since May 17, when same-sex marriages became legal in Massachusetts, state officials have invoked the little-used law to stop nonresident couples from getting married in the state.

Superior court judge Carol Ball ruled Wednesday that the law is not discriminatory, despite a concern that it violates the spirit of the state's landmark same-sex marriage decision.

Michele Granda, a lawyer with Gay and Lesbian Advocates and Defenders, said Thursday that the plaintiff couples would immediately appeal the ruling to the state appeals court in an attempt to block enforcement of the law and take down the "fence of discrimination" around the state's borders. "Gays and lesbians are being denied marriage rights simply because they're gay and lesbian," Granda said.

The state's highest court paved the way for the nation's first state-sanctioned same-sex marriages when it ruled in November that gay and lesbian couples could not be denied marriage licenses. However, out-of-state couples had their path to the Massachusetts altar blocked when Gov. Mitt Romney invoked the 1913 law and instructed city and town clerks not to issue licenses to nonresident gay couples.

In June eight couples from Connecticut, Rhode Island, New Hampshire, Vermont, Maine, and New York sued, claiming the law is inherently discriminatory.

But Ball ruled it is not because it is now being applied to both gay and straight couples. In the past the law had been applied only to couples who didn't meet their states' age requirements or who were blood relatives--and in some cases who were of different races.

One of the eight couples, Ed Butler and Les Schoof, innkeepers in Hart's Location, N.H., have been together more than 26 years. They sought and were denied a marriage license in Somerville, Mass. Butler said Thursday that they are disappointed but not disheartened by Ball's decision because they knew it would be a long legal process when they began. "We're just waiting for the Supreme Court to rule in our favor," he said with a laugh. "We're disappointed with the ruling, but we don't feel that that is more than a bump in the road at this point."