When it was reported last week that the New York City Commission on Human Rights was investigating The Wing, the co-working space for women, over its women-only membership policy, its members and advocates rushed to the company’s defense. The inquiry has generated controversy given the heightened awareness, resulting from the #MeToo movement, that sexual harassment is still rampant in far too many workplaces.

Judging by The Wing’s success as both a business venture and a place for women to gather, it has undoubtedly met a real need. Yet the commission’s job is to respond to reports of discrimination it receives, as in this case. By limiting its patrons to women only, The Wing may not be in compliance with New York’s public accommodation law — a law that exists for good reason and furthers gender equality.

New York, like nearly every state and many cities, provides that places of public accommodation can’t discriminate against members of the public based on characteristics including race, religion, disability — or sex. Antidiscrimination laws like New York’s are why we have the freedom to go about our daily lives without fear of being turned away from retail stores, banks, and hotels simply because of who we are.

Even those who agree with these principles have been tripped up by two things in the case of The Wing. It’s not a shop or a restaurant; it bills itself as a private club. Clubs that are distinctly private aren’t ordinarily subject to public accommodation laws, and in fact they can’t be. If New York tried to apply its law to a genuinely selective group — by requiring a book club formed by female college roommates to admit men, for example — that would raise serious freedom of association concerns.

But simply calling a club private doesn’t make it so. The Wing is reported to have more than 2,000 members, raising questions about whether it is truly the kind of selective group that warrants special protection. (State and local law set the threshold at 100 and 400 members, respectively.) And it offers merchandise for sale on its website, along with other hallmarks of a public-facing business. Businesses that choose to serve the public in this way subject themselves to a variety of state regulations, including antidiscrimination laws.

The second, more difficult issue is that The Wing serves women — the very group sex discrimination laws were designed to protect. Its mission is to build networks and advance women’s access to power in fields from which they have traditionally been excluded. This mission, and the creation of women-only spaces, may seem particularly compelling against the #MeToo backdrop. And, unlike some single-sex spaces, The Wing deserves credit for its inclusive policy that permits anyone who identifies as a woman, including women who are transgender, to join. Indeed, it has prominently featured women who are transgender in its publications and marketing materials. And it has put women of color front and center in its programming.

But the creation of women-only spaces can have unintended consequences, and it raises questions about who is left out. The requirement that members be “living as a woman,” for example, may exclude people who are gender nonconforming or who do not identify on the gender binary, further compounding their exclusion from public spaces. Indeed, The Wing’s own comments about how it might verify an applicant’s gender — by reviewing social media feeds to determine whether she is “living as a woman” — are troubling. How does someone’s social media profile reflect whether they are sufficiently “female”? What criteria are used to assess that?

None of this is to say that single-sex spaces are never warranted, only that the default rule against them is rooted in historical need. And it is not absolute: New York City law allows the Commission on Human Rights to grant an exemption from the default rule for places of public accommodation if there are legitimate “public policy” reasons to do so. Although The Wing has apparently not yet applied for such an exemption, it’s possible that at least some of its activities might qualify. Certainly, the goal of remedying past and continuing sex discrimination at work is a compelling public interest —of which the #MeToo movement is a powerful daily reminder.

While it’s understandable that the investigation prompted an outcry, it’s now up to The Wing and the commission to assess whether there is a solution that will satisfy legal requirements without compromising The Wing’s important mission.