FALLS CHURCH, Va. (AP) — A federal appeals court on Wednesday affirmed a Maryland beach town’s right to ban women from topless sunbathing.

A three-judge panel of the 4th U.S. Circuit Court of Appeals in Richmond ruled unanimously that Ocean City’s law, which allows men to be topless but not women, is constitutional.

READ MORE: 'Your Life Does Not End Because You Have A Diagnosis': Shantel Smith Opens Up About Her Battle With Multiple Sclerosis Before 'Survivor'

Ocean City passed its law in 2017 after one of the plaintiffs in the case, Chelsea Eline, contacted Ocean City police and asserted a right to go topless.

The panel’s ruling notes that courts across the country have upheld laws banning women from topless sunbathing on public beaches. While the law imposes a restriction on women that is not imposed on men, Judge A. Marvin Quattlebaum Jr. wrote that Ocean City’s elected leaders are within their rights to enact laws that protect public sensibilities.

“The judicial legacy of justifying laws on the basis of the perceived moral sensibilities of the public is far from spotless. Some government action that we now rightly view as unconstitutional, if not immoral, has been justified on that basis. Even so, in this situation, protecting public sensibilities serves an important basis for government action,” Quattlebaum wrote.

READ MORE: 'Every Week Is A Different Week': Harbaugh Doesn't Dwell On Jacksons 4 INTs In Cleveland Win

Town leaders said they received calls and letters overwhelmingly supporting the ban.

In a concurring opinion, Chief Judge Roger Gregory wrote that U.S. Supreme Court precedent requires upholding the ban. But he suggested the court should reconsider the issue.

“At first glance, Ocean City’s ordinance seems innocuous enough. … But we must take care not to let our analysis be confined by the limits of our social lens,” Gregory wrote. “Suppose the ordinance defined nudity to include public exposure of a woman’s hair, neck, shoulders, or ankles. Would that law not run afoul of the Equal Protection Clause?”

A town spokesman and an attorney for the plaintiffs did not immediately return calls seeking comment Wednesday afternoon.

MORE NEWS: MTA To Allow Personally Owned E-Bikes And E-Scooters On Public Transit

(© Copyright 2021 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)

CBS Baltimore Staff