SANTA FE, Tex. — Hundreds of students, parents, teachers and ministers gathered on a soggy athletic field at the junior high school here as prayers to Jesus blasted through the sound system. A band sang the spiritual hymn “Amazing Grace.” Worshipers signaled their agreement with “amen.”

Throughout the “night of hope and healing” ceremony, the superintendent of schools, Leigh Wall, clapped her hands in approval while standing in the center of the field. Then she joined a mother and a daughter and bowed her head in prayer.

Communal displays of faith have defined this district’s response to the shooting that left eight students and two teachers dead inside Santa Fe High on May 18. While some other schools affected by shootings have turned to politics — whether calling for armed teachers or demanding gun-control measures — Santa Fe’s concerns have been less about guns than God.

“Why is it different in Santa Fe?” pastor Brad Drake asked during the ceremony Wednesday evening. “Because our leadership, the leaders of our city, the leaders of our school district, the leaders of our state . . . they know where to look, and that is to the lord Jesus Christ.”

The fabric of religion and spirituality is woven into everyday life in Santa Fe, a town of about 13,000 residents, offering an immediate and fulfilling comfort from tragedy and hardship. Santa Fe is a town where residents sincerely say that what they need most is “thoughts and prayers.”

On this same school athletic field about 25 years ago, Santa Fe students made national news for reading Christian prayers over the loudspeaker before high school football games. The practice sparked a lawsuit, and the district took its skepticism about the separation of church and state all the way to the Supreme Court.

In the far-reaching 6-to-3 decision, the justices upheld a lower-court ruling that forced schools across Texas to establish firmer restrictions on student-led prayers before sporting events. But the ruling left intact students’ right to pray on their own in a school setting.

Before that decision, Marian Ward, then a Santa Fe High band member who led pregame prayer, had filed her own lawsuit, arguing that the lower court’s restrictions violated her constitutional right to free speech and freedom of religion. She won a temporary injunction to continue leading prayers at school games, but she graduated before the Supreme Court ruling.

Now living in Little Rock, Ward says her hometown’s religious response to the shooting is a reminder that Santa Fe is “still a lot like” it was in her childhood.

“The torch is kind of passed,” said Ward, 36, who remains active in faith-based causes. “It’s very much the same kind of place I remember.”

Danielle Mason, 35, also has memories from her years as a student in Santa Fe public schools. There was prayer at lunch, prayer at graduation. Around Easter, churches set up tables inside her school and gave out Bibles near the building entrance, she said.

Though she was raised Southern Baptist, Mason and her parents were uncomfortable with the ubiquitous presence of Christianity in the schools. When Mason chose not to take one of the Bibles that a group was handing out at her school, students started treating her like an outcast and called her a Satanist, she said.

“The town, from what I know from when I lived there, would rather have Bible study and prayer, then arts and music,” Mason told The Post in a Twitter direct message.

Mason left Santa Fe in 2003 but still has relatives there. She said she’s been told the town’s views on religion haven’t changed: “A prayer and god will stop gun violence,” she said.

In this overwhelmingly Baptist community, residents embrace religion from a very young age. High school clubs still elect chaplains, and the members of the football team still pray twice before games. The first prayer asks for players’ safety; the second asks for a win, according to the students.

As the community has gathered to mourn, the line between church and state has been further blurred as residents try to recover from a rampage police say was carried out by 17-year-old senior Dimitrios Pagourtzis.

Police say Pagourtzis confessed to the massacre, storming into an art class at the beginning of the school day armed with a shotgun and a .38 revolver. He faces capital murder charges.

Isabelle Laymance was in art class when she heard gunshots. She and seven other students barricaded themselves in a supply closet in Santa Fe High School.

In the hours that followed the shooting, students and parents gathered in prayer circles and around makeshift memorials.

“We just started praying for the safety of our friends,” said Aaron Chenoweth, an 18-year-old senior, who huddled with his friends across the highway from the school. “That was the only thing we could do, just put our faith in the lord and trust in the lord that everything was going to be all right.”

In the days after the shooting, the Santa Fe High baseball team gathered in a circle in the middle of the field to pray before a playoff game. A bus carrying volunteer chaplains with the Billy Graham Evangelistic Association’s Rapid Response Team parked in the high school lot. Ten white crosses that memorialized the victims appeared on the school’s front lawn, near a hand-drawn poster that read, “Take my hand, We will get through this together — Jesus.”

Jeff Naber, a member of the Billy Graham crisis response effort, said Santa Fe was a unique experience for the team, which has responded to school shootings and natural disasters across the country. He said residents here have shown how a community and the church can come together around a set of Christian values and beliefs after a tragedy.

“Because of their Christian values and beliefs, their faith base is already there, and it’s so obvious,” Naber said.

On Sunday night, Arcadia First Baptist Church hosted the town’s annual baccalaureate service for Santa Fe High’s graduating seniors. About 100 graduates attended, as did the schools superintendent, who was recognized from the dais.

Jack Roady, Galveston County’s district attorney, spoke to the students from the pulpit. His office is prosecuting Pagourtzis.

“You are entering into a war zone, and it’s a spiritual war zone,” Roady, a Republican, told students. “And you are entering into an area where you will have to deal with — and you are already dealing with — the full effects of sin in our world.

“For those of you who know him, truly know him — Christ — this time is for you,” Roady continued. “Because, believers, we shouldn’t be surprised about what we’re seeing.”

After his sermon, Roady defended his appearance, saying it had been scheduled long before the school shooting.

In a written response to a question about the role religion has played there, Assistant Superintendent Patti Hanssard said that Santa Fe Independent School District “respects and honors the community’s grieving as well as the District’s rights and obligations under the United States Constitution.”

Richard B. Katskee, legal director for Americans United for Separation of Church of State, said baccalaureate services pass constitutional muster so long as schools do not sponsor them and students are not compelled or pressured into attending.

But Katskee said placing the crosses and hosting Billy Graham ministries on school grounds would flout legal precedent.

“While the school wants to bring people together, that is not what is happening when it’s one particular faith and people of different faiths or nonbelievers are excluded,” Katskee said.

Among the crosses was one for Sabika Sheikh, a Muslim exchange student killed in the shooting.

Many residents in this town, which is wedged between marshland and suburban Houston, strongly believe there would be fewer national tragedies if more people prayed.

“I remember on 9/11, seemingly, the whole nation was praying and going to church,” said Jerl Watkins, the pastor of Arcadia First Baptist Church. “It didn’t last very long . . . but it shows me, that deep down, all of us know that there is a God, and in times of serious trouble, we turn to it.”

Santa Fe’s spiritual roots reflect a broader culture in small Texas towns, where evangelical ministers hold considerable sway over how residents pray and how they view politics and civics, said Walter L. Buenger, a professor of Texan history at the University of Texas at Austin.

Until the mid-1800s, Buenger said, it had been “generally frowned upon” for ministers in Texas to intertwine religion and politics or civics. That changed as the Texas faith community became strong proponents of Prohibition, political organization that carried into 20th-century battles over abortion and other cultural issues, he said.

Buenger said religious and political culture in Texas is showing signs of shifting due to growing diversity in the state’s population centers of Houston, Dallas and Austin and shying away from “biblical literalism.” But Santa Fe, where many residents work in the petrochemical or shipping industries, has largely retained its strong religious affiliation.

Anthony P. Griffin, the attorney who argued Santa Fe v. Doe before the Supreme Court, recalls that even the people who worked in his office were rooting against him. He would walk in the door of the office to find them in a circle with their heads bowed and eyes closed, praying he would lose, he said.

Griffin won the case and became a widely recognized civil rights attorney. But he surrendered his law license in 2015 after several ethics complaints were filed against him.

At Wednesday’s community-wide prayer service, residents said that, in the aftermath of the shooting, they hope the focus remains where it belongs — on the victims and on God.

“I just think this town needs God,” said Nathan Kruger, 16, as he squished his cowboy boots in the rain-soaked turf. “When people don’t have nothing to lean on, God’s always there for you. And that’s what I need right now.”

Julie Tate contributed to this report.

Correction: A previous version of this story included incorrect information about the school Danielle Mason attended. She withdrew from Santa Fe public schools after she completed the 6th grade and did not attend the public high school. The story has been corrected.