Saying a high school teacher has no right to "use his public position as a pulpit," a federal appeals court ruled Tuesday that a San Diego County school district was on solid legal ground when it ordered a math instructor to remove large banners declaring "IN GOD WE TRUST" and "GOD SHED HIS GRACE ON THEE."

Those inscriptions and others that longtime teacher Bradley Johnson displayed on his classroom wall amounted to a statement of religious views that the Poway Unified School District was entitled to disavow, said the Ninth U.S. Circuit Court of Appeals in San Francisco.

Under U.S. Supreme Court rulings, the appellate panel said, government employees, including public schoolteachers, have no constitutional right to express views in the workplace that contradict their employer's rules or policies.

"Johnson took advantage of his position to press his particular views upon the impressionable and captive minds before him," said Judge Richard Tallman in the 3-0 ruling, which reversed a lower-court decision in the teacher's favor.

The district "acted well within its constitutional limits in ordering Johnson not to speak in a manner it did not desire," Tallman said.

The two banners, each about 7 feet by 2 feet, contained references to God from U.S. documents and patriotic songs. One quoted the Declaration of Independence passage that all men are "endowed by their CREATOR" with unalienable rights.

Johnson said he had hung the same banners since 1982, but no one complained until another teacher contacted the principal in 2006. He told the principal he had the right to display patriotic messages that expressed his view of the nation's heritage, and shrugged off her suggestion that some students would feel unwelcome, the court said.

He also accused the district of discriminating against Christians, since it allowed other teachers to display Tibetan prayer flags and a poster with the lyrics to John Lennon's song "Imagine," which includes lines about imagining no heaven, hell or religion.

A federal judge overturned the district's order to remove the banners last year and said school officials had discriminated against Johnson based on his viewpoint.

The appeals court disagreed, saying the other teachers' displays were not intended to promote religion - the Tibetan prayer flags, for example, were posted for a science class discussion of fossils found near Mt. Everest and were never identified by any student as religious.

Johnson's lawyer, Robert Meuse of the Thomas More Law Center, a conservative Christian firm, said he was disappointed by the ruling and would ask the full appeals court for a rehearing.

The schools' lawyer, Jack Sleeth, said the ruling reaffirmed "a district's authority to control a teacher in the classroom" and was only incidentally about religion.

But Rob Boston, spokesman for Americans United for Separation of Church and State, said the court had strongly supported public schools' duty of religious neutrality. Attorney David Blair-Loy of the American Civil Liberties Union agreed but said he was dismayed that the court had found no right to academic freedom for public schoolteachers.

Teachers shouldn't promote their religious views and should follow the assigned curriculum, Blair-Loy said, but "there should be room for creativity, provocative discussion and dialogue."

The ruling, which includes photos of the banners, can be viewed at links.sfgate.com/ZLCW.