Japan's ban on same-sex marriages does not violate the constitution, a district court in Osaka has ruled.
The ruling dealt a blow to gay couples and rights activists, after another district court in Sapporo ruled in 2021 that the failure to recognise same-sex marriage was "unconstitutional".
Japan's constitution defines marriage as one between "both sexes".
It is the only country in the G7 group of developed nations that doesn't allow people of the same sex to marry.
Opinion polls show a majority of the general public is in favour of allowing same-sex marriage in Japan.
Several areas - including Tokyo - have begun issuing partnership certificates, to help same-sex couples rent properties and gain hospital visitation rights.
The Osaka case was filed by three same-sex couples, two of them male and one female. The case is only the second of its kind to be heard in the country, where conservative attitudes towards homosexuality remain.
In addition to rejecting their claim that being unable to marry was unconstitutional, the court also dismissed demands for 1 million yen ($7,414; £6,058) in damages for each couple who argued they had suffered "unjust discrimination" by not being allowed to marry.
But the court also noted there had not been enough public debate about same-sex marriage and that "it may be possible to create a new system" recognising the interests of same-sex couples.
"From the perspective of individual dignity, it can be said that it is necessary to realise the benefits of same-sex couples being publicly recognised through official recognition," the court said in its ruling.
"Public debate on what kind of system is appropriate for this has not been thoroughly carried out."
The court's decision is seen as a setback for gay rights activists and couples, who were hoping to ratchet up pressure on the Japanese government to address same-sex unions.
"This is awful, just awful," an unidentified female plaintiff said to reporters outside the courthouse in footage aired on public broadcaster NHK after the ruling.
An LGBTQ activist based in Tokyo told the Reuters news agency that the ruling was "disappointing".
"After the Sapporo ruling, we were hoping for the same ruling or something even better," Gon Matsunaka said.
The plaintiffs plan to appeal against the decision, Kyodo news agency reports.
Japan's constitution, put in place after the end of World War Two, defines marriage as one of "mutual consent between both sexes".
Under the current rules, same-sex couples are not allowed to legally marry, can't inherit their partner's assets, and have no parental rights over their partner's children.
Though partnership certificates issued by some individual municipalities help same-sex couples to rent a place together and have hospital visitation rights, they do not grant them the full legal rights enjoyed by heterosexual couples.
Activists also say conservative attitudes towards homosexuality mean many LGBTQ Japanese still do not dare to come out to their friends and family.