A dreaded day turned jubilant Friday, when the suffering Gunn High School community fought Westboro Baptist Church’s brimstone with fire, muting an ugly message with song, flag-waving and raucous celebration.

United against the small cadre of Kansas-based outsiders who targeted the Palo Alto campus because of its recent suicides, Gunn altered its lesson plans this week to teach a tough lesson in tolerance — and test its commitment to the freedoms of speech, assembly and religion.

By the time the five visitors arrived on the public sidewalk across from campus, the school was ready — countering “God Hates You” placards with the equally powerful: “Love Thy Neighbor As Thyself,” “There Is Nothing Love Cannot Face,” “Gay? Fine By Me,” and “Gunn Stands Together!”

“It’s been a rough year here, but today was a good day,” said Faith Hilal, who teaches world history and U.S. government.

“The kids felt a sense of unity — they were uplifted,” she said. “It is not what we were expecting. It was inspiring.”

Members of the Westboro Church, a traveling theater of religious extremists, gathered on Arastradero Road to flay the most unlikely victims: school children already traumatized by the five recent suicides of Gunn-associated students.

“You’ll be in front of the train next! God laughs at your calamity!” shouted Margie Phelps, the daughter of Westboro Church founder Fred Phelps, a disbarred lawyer with a craving for publicity and a fixation on hatred of homosexuality.

Courageous reaction

Phelps and her small tribe of apocalyptic followers travel across the land they call a “modern Sodom,” making brief appearances at places that, in their view, have committed the ultimate transgression — acceptance of homosexuality.

To the tune of America The Beautiful, they sang: “Oh Sodomites, your kids are killed by trains. Your moral compasses are broken, your teachers are to blame.”

In response to the students’ signs, Phelps, an attorney, explained: —‰’Love thy neighbor’ ” is not meant in this context.”

The Gunn community — joined by dozens of students from Menlo Park, Fremont and other nearby schools — responded to the protesters by playing guitars, pounding drums, hugging and singing “Let It Be.” “After what we’ve been through, it’s wrong for them to be here,” said Gunn student Katerina Ermolin, 14.

“It really helped to pull us together,” said Souleymane Sarr, 15, a Gunn student. “We’ve got good solidarity in our school.”

Even the school’s giant digital sign participated. It trumpeted quotes by German philosopher Johann von Goethe (“There is nothing more frightening than active ignorance”); physician William Osler (“The greater the ignorance, the greater the dogmatism”) and a Bay Area creed (“Celebrating diversity”).

“I’m so proud of our young people,” said Krishnamachar Sreenivansan, a retired Hewlett-Packard mechanical engineer with a grandchild at Gunn. “We have the finest students.”

Stanford also ready

Hilal said news that the Westboro members were arriving created some anxiety among students this week. But teachers and counselors used the unsettling occasion to stimulate vigorous discussion and debate using the real-world example to illustrate the abstractions of the U.S. Constitution.

In her classes, Hilal taught students: “The same freedom that allows us to express ourselves, allows the people who disagree with us to express their points. It’s there for all of us.”

And she added: “But the courts have confined that freedom, so that once someone steps on campus, there are limits to what they can say. That’s why you’re safe — and they’re across the street, on public property.”

School administrators distributed “Talking Points” to create a united message of reassurance. They postponed the school’s start time Friday morning so students could avoid the protesters. They held a rally at lunchtime. Police were called. And they instructed students to stay on campus.

The Topeka-based group then traveled to Stanford University’s Taube Hillel House, where they were greeted by the dancing Stanford Tree mascot, the Stanford Band, several hundred students and a bagpipe player performing a haunting rendition of “Amazing Grace.”

It was only 8 a.m., an hour when most college students are still asleep. But word had spread across campus through e-mails from student groups and conversation, and a bold crowd awaited the far-outnumbered church members.

Some students posed for pictures with the visitors, holding signs like one that read “Gay for Fred Phelps.”

“I just wanted to come out and show them that being a Christian isn’t about hate, it’s about love,” said Monica Alcazar, a Stanford freshman and Gunn graduate.

Bay Area News Group Staff Writer Diana Samuels contributed to this report. Contact Lisa M. Krieger at 408-920-5565.