The Virginia Senate invoked Emanuel AME Church in Charleston, S.C., site of a 2015 massacre, before passing a bill allowing people to carry guns in houses of worship. (Brendan Smialowski/AFP/Getty Images)

— Virginians could legally bring their guns to church under a bill that cleared the state Senate this week and sparked an emotional debate over whether packing heat in a house of worship constitutes a snub to the Almighty.

“Psalm 46 said, ‘God is our refuge and strength,’ ” Sen. Lionell Spruill Sr. (D-Chesapeake) said as he argued against the measure Thursday. “Now we are saying, with this bill, we no longer trust in God.”

The bill repeals a law thought to date to Colonial times that makes it a misdemeanor to “carry any gun, pistol, bowie knife, dagger or other dangerous weapon without good and sufficient reason, to a place of worship” during religious services.

While Virginia has a strong gun culture and some of the nation’s most lax firearms laws, churches have been gun-free zones — although the “good and sufficient reason” language offers a loophole.

In 2011, then-Attorney General Ken Cuccinelli II (R) issued an opinion that the ban would not apply to someone with a ­concealed-carry permit. Some Republicans contend that makes the existing law unenforceable. They also said plenty of Virginians are already coming to worship armed.

Sen. Richard H. Black (R-Loudoun) wants to repeal the law. He made note of mass shootings at a Sikh temple in Wisconsin in 2012 and at an African Methodist Episcopal church in South Carolina in 2015 as he pitched his bill on the Senate floor.

“It really sent shock waves through all churches,” he said of the massacres. “These folks are uniquely vulnerable because they’re lined up in a church pew; exiting the pew is very difficult. It makes them the ultimate target. . . . Either you cower in place or you fight back.”

The Senate passed the measure 21 to 19, with every Republican in favor and every Democrat opposed. It now heads to the House, where similar measures died in committee last year.

A spokeswoman for Gov. Ralph Northam (D) said the governor opposes the bill. He “is disappointed to see the General Assembly take up none of the reasonable gun safety measures he proposed at the start of the session, including the extreme risk protection order signed into law by Republican governors and endorsed by President Trump’s school safety commission,” spokeswoman Ofirah Yheskel said.

Before the vote, the Senate engaged in an extended debate. Republicans argued that individual churches should decide if they want guns in their pews, while Democrats warned that worshipers could wind up victimized with their own guns. Then came a spinoff debate over Spruill’s claim that worshiping while armed belies a lack of faith.

“We . . . foolishly took prayer out of schools . . . and now we want to take God out of church,” Spruill said. “If there’s anywhere you can trust God, it should be the church. Let’s depend on God on this one. Let’s not take God out of church.”

Sen. J. Chapman “Chap” Petersen (D-Fairfax) struck a similar note: “When I walk into a house of worship, it humbles me. You need to act and be your best, and that means putting down your firearm.”

Black objected to the idea that guns and God don’t mix, recalling his time as a Marine in battle in Vietnam.

“I do not accept that God abandons those who are armed,” he said.

Sen. Charles W. “Bill” Carrico Sr. (R-Grayson) sided with Black. After the vote took place and the Senate turned to other business, Carrico turned to his Bible to try to bolster his argument. Before the Senate gaveled out for the day, he rose to share what he’d found.

“ ‘Blessed be the Lord, my rock, who trains my hands for war and my fingers for battle.’ That was from the Old Testament,” he said. “In the New Testament, . . . ‘When a strong man fully armed guards his own palace, his goods are in peace.’ Those places of worship where I tithe, where I give offerings, are that palace. And it’s my obligation and our right to defend it.”