Legal challenge over same-sex marriage comes a step closer