10:44 AM ET

The Supreme Court ruled in favor of a football coach from Washington state who wanted to kneel and pray on the field after a game.

The court ruled 6-3 in favor of Joseph Kennedy, who was an assistant coach for the high school's football team and head coach of the junior team.

Students joined Kennedy for prayers after games. Kennedy said he would take a knee and pray after each game. He refused to stop praying despite being asked by school officials to stop. Kennedy's contract wasn't renewed in 2015.

Kennedy's case went to the Supreme Court after he sued.

The court's three more liberal members compared the hypothetical prayers of other school officials to Kennedy's prayers. Kennedy's prayers were compared by members of the court's six-member conservative majority to other non- religious actions.

Justice Clarence Thomas wanted to know how the school district would respond if the coach took a knee during the national anthem to protest racism.

The coach's invocation was protected by the First Amendment.

Justice Neil Gorsuch wrote for the majority that the Constitution and the best of our traditions counsel mutual respect and tolerance.

The justices wrestled with how to balance the religious and free speech rights of teachers and coaches with the rights of students not to feel pressured into participating in religious practices. Some religious practices in the public school setting could be accepted by the community.

The Supreme Court has ruled in favor of religious groups in the past. The court ruled that Maine can't exclude religious schools from a program that offers tuition aid for private education, which could make it easier for religious organizations to get taxpayer money.

Information from The AP was used in this report.