A federal judge has tossed a lawsuit challenging the N.C. law that allows magistrates to opt out of performing marriage ceremonies if they hold religious objections to same-sex marriage.

Judge Max Cogburn ruled that none of the three couples challenging the law had standing to sue, and none had suffered direct harm from the 2015 law.

The law allows a magistrate to opt out of performing all marriage ceremonies, but does not allow him to pick and choose between marriages involving same-sex couples and those with opposite-sex couples. If the magistrate chooses to opt out of marriage ceremonies, another magistrate takes over that duty.