A New Brunswick judge has handed down a decision that opens the door to same-sex marriages in the province.

Court of the Queen's Bench Judge Judy Clendenning ruled in favour of four gay couples, who argued that New Brunswick's current definition of marriage violated their rights.

In a written decision handed down in Moncton on Thursday, she said the definition of civil marriage would have to be changed from a lawful union between a man and a woman to a lawful union "between two persons."

Alison Menard, the lawyer who represented the couples, said the effect of the ruling is that same-sex marriage can now be carried out in New Brunswick.

"What it means is that anybody that meets the definition of capacity to marry is able to go and get a marriage licence," Menard said.

"So in this particular circumstance, couples of same gender will be able to obtain marriage licences and celebrate marriages."

The ruling leaves P.E.I., Alberta, Nunavut and the Northwest Territories as the last jurisdictions in the country that do not recognize same-sex marriage.

It gives New Brunswick a 10-day grace period to get the new marriage definition into place.

Premier Bernard Lord has said he personally believes in the traditional view of marriage. But he said the province wouldn't put up a fight if the courts or Parliament ordered it to make a change.

Several church-based groups had applied for intervener status in the case to argue against same-sex unions.

But the judge turned them down, saying that her ruling would not prevent the churches from opting not to perform marriage ceremonies for gay couples.

Gay organizations hailed Clendenning's decision as a huge step forward.

"Homosexuals in our province are going to be less looked down upon," said Eldon Hay, who runs a support group for parents and families of gay people.

"Since the legislation will be changed, it means that gays and lesbians will be on an equal playing field. That's the big change."