Updated

A lawyer for eight out-of-state gay couples urged Massachusetts' (search) highest court Thursday to throw out a law that prevents them from marrying in the only U.S. state that grants same-sex marriages.

Other states are closely watching the case because if the Supreme Judicial Court (search) strikes down the law, same-sex couples nationwide could come here to wed and demand marriage rights in their home states.

The court heard arguments over the 1913 law, which bars licenses from being issued to couples if the union would not be recognized in their home state.

Plaintiffs' lawyers argued the law is being used to discriminate against gay couples from other states.

Assistant Attorney General Peter Sacks (search) defended the statute, saying it is being enforced in an evenhanded way for heterosexual and same-sex couples.

Sacks also said Massachusetts must respect other states' laws. Many states have passed constitutional amendments defining marriage as the union of one man and one woman.

Michele Granda, a lawyer for Gay & Lesbian Advocates & Defenders arguing on behalf of the plaintiff couples, rejected that claim.

"Marriage with or without this statute does not force any other state to make a decision on marriage," she said.

The Supreme Judicial Court, which is likely to issue a ruling in several months, compelled Massachusetts to become the first and only state to allow gay marriages in May 2004.

As same-sex marriage became legal, Gov. Mitt Romney ordered city and town clerks to enforce the residency requirement and wrote to every other governor in the nation that out-of-state same-sex couples would not be allowed to marry in Massachusetts.

"If you can't be legally married in your home state, then you can't evade the law by coming to Massachusetts to get married," Romney spokesman Eric Fehrnstrom said.

The eight couples — from Connecticut, Rhode Island, New Hampshire, Vermont, Maine and New York — wanted to get married in Massachusetts and were denied the chance to do so.

A lower court judge upheld the residency law last year, saying that while she was troubled by the state's decision to suddenly begin enforcing it, the law was not discriminatory because the state has reason to ensure that marriages in Massachusetts are valid in other states.