INDIANAPOLIS — The Indiana Court of Appeals has ordered a trial court to grant a permanent injunction barring the state from arresting serious sex offenders for attending churches that hold Sunday schools or offer child care.

The court on Tuesday ruled in favor of three unnamed sex offenders in overturning a Boone County court decision that determined churches are school property under a 2015 law passed by the General Assembly.

The law defined serious sex offenders as those found to be violent or convicted of sexual crimes, and it barred them from knowingly entering school property. After it took effect, Boone County authorities sent a letter to their registered sex offenders notifying them of the new law, and the three plaintiffs sued, complaining the statute violated Indiana’s Religious Freedom Restoration Act.