A number of large retailers, including Dick’s Sporting Goods and Fred Meyer parent, Kroger, have announced that they’ll stop selling guns to anyone under the age of 21. The policy is aimed at the sale of rifles and other long guns, which in Oregon and elsewhere may be bought by people who are at least 18 years old.

These policies are certainly well-intended, and Oregon’s age requirement is certainly worth debating. However, the proposed actions of Dick’s, The Kroger Co. and other companies have one drawback: They almost certainly amount to illegal age-based discrimination under Oregon law.

The law provides that “all persons … are entitled to the full and equal accommodations, advantages, facilities and privileges of any place of public accommodation, without any distinction, discrimination or restriction on account of race, color, religion, sex, sexual orientation, national origin, marital status or age if the individual is of age, as described in this section, or older.” According to the Oregon Bureau of Labor and Industry’s Civil Rights Division, a person is “of age” for purposes of this law at 18.

A retailer like Dick’s or Fred Meyer is a place of public accommodation subject to the state’s anti-discrimination law, and retailers have drawn the wrath of public officials, civil liberties organizations and the public for violating it in the past. Sweet Cakes by Melissa, a Gresham bakery, was sanctioned harshly by the state for refusing to bake a wedding cake for a lesbian couple in 2013. Discriminating on the basis of age is no more acceptable under the law than discriminating on the basis of sexual orientation. And that’s exactly what retailers have proposed to do by saying they’ll sell a rifle to someone who’s 21, but not someone who’s 20.

Imagine for the sake of argument that a retailer announced that it would no longer sell rifles, cars or whatever to people older than a certain age because, in the retailer’s view, advancing age rendered such people incapable of applying good judgment in the use of these products. Many people would be justifiably outraged. Yet that’s exactly what retailers are proposing to do on the other end of the age spectrum.

State officials and civil liberties groups like the ACLU of Oregon ought to oppose this form of discrimination as zealously as they do other forms. They should push retailers to pursue their convictions in a legally defensible manner. One good option is to keep selling rifles as the law allows while pushing the Legislature to raise the purchase age to 21.