A federal appeals court in San Francisco upheld a decision by a Southern California school district to order a math teacher to remove classroom banners that included the phrases “In God We Trust” and “God Shed His Grace on Thee.”

The 9th U.S. Circuit Court of Appeals dismissed a civil rights lawsuit filed by high school math teacher Bradley Johnson against the Poway Unified School District in San Diego County.

In 2007, school district officials ordered Johnson to take down from his classroom walls two large banners, each about 7 feet wide and 2 feet tall, that contained religious references.

The appeals court said the school district’s action didn’t violate Johnson’s free speech rights because he was in the classroom as a school district employee, not a private citizen.

A three-judge panel said school officials were entitled to conclude that the banners might make non-Christian students uncomfortable and could risk favoring a particular religion in violation of the U.S. Constitution.

Judge Richard Tallman wrote that Johnson still had the right to air his views on God “on a sidewalk, in a park, at his dinner table, or in countless other locations.”

But Tallman said the officials were justified in ordering the teacher “not to use his public position as a pulpit from which to preach his own views on the role of God in our nation’s history to the captive students in his mathematics classroom.”

One of Johnson’s banners displayed the four phrases “In God We Trust,” “One Nation under God,” “God Bless America” and “God Shed His Grace on Thee.”

The other read, “All men are created equal, they are endowed by their CREATOR,” with the word “creator” twice as large as other words.

Johnson argued that the phrases expressed patriotic sentiments, but the court said, “It seems as plain to us as it was to school officials that Johnson’s banners concern religion.”