Three years ago, before gunfire erupted at a Sunday morning service, members of the close-knit Sikh community in suburban Milwaukee seldom locked the temple doors.

Those who arrived Thursday evening to pray for the victims in Charleston, S.C., are still adjusting to ringing a buzzer for a security guard to let them inside. This is life at the Sikh Temple of Wisconsin after a gunman killed five men and one woman in 2012, the last major bloodshed at a place of worship in the United States.

“It used to be in the Sikh religion, all doors stayed open,” said Balhair S. Dulai, vice president of the temple. “But what happened here, and what happened in South Carolina — these things could happen anywhere. No one is immune.”

The temple’s Thursday gathering focused on Charleston’s Emanuel African Methodist Episcopal Church, a historic ­African American church,
where authorities say Dylann Roof, 21, fatally shot nine people during a Wednesday night service in an apparent hate crime.

News of the tragedy rocked the Sikh community in Wisconsin. Members recall the day that Wade Michael Page, a white supremacist, stormed the temple and sprayed automatic gunfire as priests were preparing lunch.

Worshipers scattered in the chaos that August morning, locking themselves in bathrooms and rushing outside. The bullets killed six and wounded three. After an Oak Creek police officer shot Page in the stomach, the gunman put the weapon to his head, taking his own life.

There have been 13 mass murders at a house of worship since the Birmingham, Ala., bombing that killed four African American girls in 1963, according to the FBI. The Charleston shooting was the bloodiest since Johnathan Doody killed nine people at a Buddhist temple near Phoenix in 1991.

When violence shakes a house of worship — a symbol of comfort and safety for millions across the globe — confusion often intensifies loss, said Mary Moschella, a professor of pastoral care and counseling at Yale Divinity School. The place where many would seek comfort after a traumatic event is also the site of the nightmare.

“It represents a home, especially for those who come not just on Sunday but for a Wednesday night Bible study,” Moschella said of the Charleston church. “Going back becomes an act of courage, a way of reclaiming the space as sacred.”

Bishop Robert Guglielmone of the Diocese of Charleston called the church a “sanctuary” in a Thursday statement. “For anyone to murder nine individuals is upsetting,” he said, “but to kill them inside of a church during a Bible study class is devastating to any faith community.”

Dismantling that community wasn’t an option after the gunman invaded the Wisconsin temple.

After the shooting, temple leaders met with state leaders and a terrorism task force to design a new security system for the 17,000-square-foot building. The $75,000 protections resemble those at a military base. Twenty-four cameras monitor the sprawling grounds, broadcasting footage to the local police department.

Contractors have reinforced windows to withstand bullets. New safe rooms have the capacity to hide the temple’s approximately 500 worshipers, Dulai said. Only a couple of suspicious people have drawn police to the premises, he said, and ultimately they proved harmless.

An estimated 314,000 Sikhs live in the United States, according to the Association of Religion Data Archives. The Oak Creek temple, one of two prominent congregations in greater Milwaukee, started in 1997. Membership has grown since the tragedy.

Worshipers enter the light-brown brick building without fear, Dulai said. Those who lost family members and friends in the 2012 rampage come to pray each week. “They never stopped,” he said. “That only makes us stronger.”

Dulai said he hopes those who lost loved ones in Charleston will also find comfort in their faith.

Sarah Pulliam Bailey contributed to this report.