A federal appeals court on Wednesday ruled against a high school football coach who was suspended for kneeling in prayer after games, saying it was unlikely the coach could show that a school district in Washington state violated his constitutional rights.

A three-judge panel of the 9th Circuit Court of Appeals said Wednesday that the coach "took advantage of his position to press his particular views upon the impressionable and captive minds before him."

"We hold that [Coach Joseph] Kennedy spoke as a public employee when he kneeled and prayed on the 50-yard line immediately after games while in view of students and parents," wrote Judge Milan D. Smith for the panel opinion of the western federal appeals court. "Kennedy therefore cannot show a likelihood of success on the merits of his First Amendment retaliation claim."

Kennedy sued the school district for violating his First Amendment rights and for violating the Civil Rights Act of 1964. The coach sought an injunction ordering the school district to "cease discriminating against him," reinstate him as a coach and allow him to kneel and pray after games.

The appeals court agreed with the district court that had rejected his request for an injunction.

Kennedy served as an assistant football coach at Bremerton High School from 2008 to 2015, where he regularly led coaches and students in pre- and post-game locker room prayers. Kennedy separately prayed alone at midfield after football games from the outset of his time with the school, and several players decided to join him early in his first season with the team.

"Eventually, Kennedy's religious practice evolved to something more than his original prayer," Smith wrote. "He began giving short motivational speeches at midfield after the games. Students, coaches and other attendees from both teams were invited to participate. During the speeches, the participants kneeled around Kennedy, who raised a helmet from each team and delivered a message containing religious content."

An employee at a different school district mentioned the coach's practice of praying after games to the Bremerton School District in 2015, which began an investigation to determine if the coach was following the school district's policy on "religious-related activities and practices."

The school district's superintendent wrote the coach to tell Kennedy that he could continue to give motivational talks so long as they were "secular" in nature and that he must not suggest, encourage or otherwise endorse religious activity by the students as a coach who was part of the school district's staff.

When Kennedy next decided to pray at midfield after a game, coaches and players on both teams joined him — as did members of the general public and media. After the game, the school district "received complaints from parents of band members who were knocked over in the rush of spectators on to the field" to join him.

"Sometime after the game, members of a Satanist religion contacted the District and said they 'intended to conduct ceremonies on the field after football games if others were allowed to,'" the 9th Circuit wrote. "Ultimately, the district made arrangements with the Bremerton Police Department to secure the field after games, then posted signs, made "robocalls" to school district parents, and "otherwise put the word out to the public that there would be no [future] access to the field."

The Satanists attended the next game, but chose not to enter the bleachers or take the field after the game.

The school district then suspended Kennedy for failing to follow its directives because it said his post-game activities showed him neglecting his responsibility to supervise the students following the games until the players were released to their parents.

While suspended, Kennedy could not participate in any team activities but was allowed to attend games as a member of the public. Kennedy came to a game and prayed in the bleachers in his team's apparel "with news cameras recording his actions."

At the end of the 2015 season, "The athletic director recommended that Kennedy not be rehired because Kennedy 'failed to follow district policy' and 'failed to supervise student-athletes after games due to his interactions with [the] media and [the] community,'" the court wrote

Kennedy sued the school district for violating his First Amendment rights and for violating the Civil Rights Act of 1964. The coach sought an injunction ordering the school district to "cease discriminating against him," reinstate him as a coach and allow him to kneel and pray after games.

A district court rejected the coach's request for an injunction, which the western federal appeals court agreed with on Wednesday.

"We conclude that Kennedy spoke as a public employee, not as a private citizen, and therefore decline to reach whether [the school district] justifiably restricted Kennedy's speech to avoid violating the Establishment Clause," Smith wrote. "Kennedy accordingly cannot show a likelihood of success on the merits of his First Amendment retaliation claim and is not entitled to the preliminary injunction he seeks."

"While we recognize the important role that public worship plays in many communities, as well as the sincere desire to include public prayer as a part of [these] occasions," such activity can promote disunity along religious lines and risks alienating valued community members from an environment that must be open and welcoming to all."

The coach appears to have an ally in President Trump, who tweeted a message of support for the coach while campaigning in 2015.

"Support Coach Kennedy and his right, together with his young players, to pray on the football field," Trump tweeted on Oct. 31, 2015. "Liberty Institute just suspended him!"

Trump's tweet was inaccurate, however, as First Liberty Institute is Kennedy's legal counsel that filed the coach's lawsuit. The Bremerton School District suspended the coach.