(The 2nd U.S. Circuit Court of Appeals in New York, 10 July 2012/Bjoertvedt )

New York City’s ban on religious worship services inside school buildings after hours was ruled constitutional on Thursday by a federal appeals court.

In a 2-1 decision, the 2nd U.S. Circuit Court of Appeals said the New York City Board of Education’s regulation, created so the city would not be perceived as endorsing religious activity in a public forum, “was consistent with its constitutional duties.”

The rule prohibits school buildings from being used for religious worship services or as houses of worship, but the city allows groups to use schools for non-religious activities.

The appeals court’s decision marks the latest chapter in a two-decade legal battle between the city’s Board of Education and religious groups over the regulation.

It reversed a June 2012 decision from U.S. District Judge Loretta Preska, who permanently enjoined the city from enforcing the ban. Preska had held that allowing the worship services did not suggest that the school would be endorsing religion.