CHARLESTON, W.Va. — A judge has ruled that a West Virginia law allowing guns in city recreational centers doesn’t apply to ones leased for school activities.

Guns are even banned at those facilities when school events aren’t happening, as long as a school board leases or otherwise possesses it, according to the Sept. 21 ruling by Judge James Stucky in Kanawha County Circuit Court.

The judge ruled that the 2014 law backed by the National Rifle Association allows concealed carry permit holders to bring guns to city rec centers not used by schools if they are stored in a holster, purse or bag. Those guns must be “attached to the individual, firmly adhered to one’s body,” and “not freely placed,” the judge’s order states.

The judge said they could also be stored in locked lockers or gun cases, but cities aren’t required to provide that storage option at their facilities.

Charleston Mayor Danny Jones filed the lawsuit in 2014 seeking clarity about facilities used by schools, including swimming pools, tennis courts or after-school centers because it’s already illegal to bring guns on school-used property.

The judge sided with the mayor on that issue, ruling that it’s already a felony punishable by two to 10 years in prison to bring a gun into a building on ground owned or operated by schools, or where school functions are taking place.

The West Virginia Citizens Defense League, a gun rights group, considered the ruling a “major legal victory,” despite school-related facilities remaining off limits. The group called it a “big precedent” to be able to keep guns in holsters, purses or bags while in city rec centers.

The law was passed by a Democratic majority Legislature and signed by then-Gov. Earl Ray Tomblin, also a Democrat. The state now is led by Republican lawmakers and Gov. Jim Justice, who recently switched from Democrat to Republican.