New Jersey on Wednesday stopped short of becoming the second state in the nation to legalize same-sex marriage by judicial fiat.

The state’s high court, while declaring unconstitutional state laws that deny same-sex couples the financial and social benefits and privileges given to married heterosexuals, held that fixing the problem is a legislative task — and gave lawmakers 180 days in which to do it.