The US state of New Jersey's Supreme Court has ruled that gay couples are entitled to the same rights as heterosexual couples.
Only one US state has allowed same-sex marriages so far
But the court says it is for the legislature to decide whether the state will honour gay marriage or some other form of civil union.
Lawmakers have been given six months to decide whether to change marriage laws.
It follows a case brought by seven gay couples, who claimed that the state's constitution entitled them to marry.
"Times and attitudes have changed," the New Jersey State Supreme Court said in its 90-page ruling.
But it concluded that it "cannot find that the right to same-sex marriage is a fundamental right under our constitution".
New Jersey is one of only five US states without either a law or a state constitutional amendment blocking same-sex marriage.
Advocates on both sides had believed it was more likely than other states to allow gay people to wed, as it has a tradition of expanding civil rights.
The state authorised domestic partnerships two years ago.
Currently, only Massachusetts allows same-sex marriages.
Massachusetts is the only US state to allow gay weddings
The court's decision was welcomed as a partial victory by both advocates and critics of gay marriage.
"It may not be a complete win, but it is a very substantial win," said Matt Coles of the American Civil Liberties Union.
But Michael Behrens, a lawyer for the Coalition to Preserve and Protect Marriage, said the court had stopped short of granting homosexual couples the rights to the benefits of marriage.
In July, the top court in Washington state upheld a gay marriage ban.
The decision followed a string of setbacks for same-sex marriage advocates in other parts of the US, including in several states where votes were held on amending bans on same-sex unions.
Cases similar to that in New Jersey are pending in California, Connecticut, Iowa and Maryland.
Lawyers for the seven couples had asked the court to overturn an appeals court ruling that the New Jersey legislature must decide whether gay marriage should be allowed, rather than the state's Supreme Court.
The ruling means that the appeals court decision was upheld and it remains the responsibility of the legislature to take the decision on sanctioning gay marriage.