The city’s law, passed in December 2017, was sponsored by Melissa Mark-Viverito, then the Council speaker. It prohibited consumers from being charged “for services intended to change a person’s sexual orientation or gender identity,” and created a $1,000 fine for each violation.

In January, the Alliance Defending Freedom, an Arizona-based group, filed a lawsuit challenging the law on the grounds that it violated free speech, suggesting that the measure was “the first in the nation to censor speech” between counselors and adult patients.

“This law was a textbook violation of free speech and the right of individuals to pursue the lives and identities they want to exercise,” said Roger Brooks, a senior lawyer for the group, which says its mission is to defend religious freedom.

“We went in with confidence that the courts would agree with us,” he said. “This move by the city suggests that on mature consideration, they think that would be the outcome as well.”

Medical professional organizations have long denounced the practice of conversion therapy. The American Psychological Association found in a 2009 report that the practice does not work and that “individuals experienced harm” from the therapy. The therapy is also predicated on the false notion that L.G.B.T. sexual orientation is a mental disorder.

Individuals who are “distressed by their sexual orientation” say that they benefit “when offered interventions that emphasize acceptance, support and recognition of important values and concerns,” according to the report.

Eighteen states, the District of Columbia and more than 50 municipalities have passed conversion therapy bans for minors, according to the National Center for Lesbian Rights. That still has not stopped the therapy from happening.