The groups sued on behalf of three religious couples.