A Washington state public school district violated the constitutional rights of a former football coach by barring him from praying on the field at the end of games, a divided U.S. Supreme Court ruled on Monday.

In a 6-3 decision, Justice Neil Gorsuch, writing for the majority, said the school district mistakenly believed that allowing Joseph Kennedy to offer prayers on the 50-yard line would violate the First Amendment’s establishment clause. Instead, the district violated Kennedy’s rights under the First Amendment’s free speech and free exercise of religion clause.