ROCKVILLE CENTRE, N.Y. — It is a nightly ritual. Men and women head to the rooftop bar at Kasey’s Kitchen and Cocktails here on Long Island, only to be turned away because they are not old enough. But there is a quirk in the establishment’s policy for its rooftop bar, which states men must be at least 30 and women, just 25.

The motivation behind the disparity might be fairly transparent to the average bar patron. But is it legal?

A co-owner of Kasey’s, Anthony Geraci, said that in his bar he could set whatever policy he liked.

“If you build a house, you decorate it the way you want,” said Mr. Geraci, who opened Kasey’s with Tom McNicholas in 1999. “I could open a bar tomorrow and it could be an over-40s bar.”

Mr. Geraci was partly right, according to Donna Lieberman, the executive director of the New York Civil Liberties Union, but she said separate policies for men and women amounted to gender discrimination. Mr. Geraci could open an over-40s bar, Ms. Lieberman said, as long as everyone, man or woman, was allowed in at the same age.