RICHMOND, Va. - The GOP-controlled Virginia Senate voted on Tuesday to repeal an old law banning guns - as well as bowie knives, daggers and other weapons - from places of worship.

Sen. Ben Chafin, R-Russell, said the "archaic law," thought to date back to Colonial times, treads on the private property rights of churches. He also said it threatens the safety of worshippers, noting the massacre of 26 people at a Texas church in November.

"For any of us to sit here and think that when a gunman comes to you, that a law is going to somehow protect you is sheer lunacy," Chafin said amid a spirited floor debate.

The measure passed along party lines by a 21 to 18 margin, with one Democrat absent. The bill now heads to the House, which like the Senate is narrowly controlled by Republicans.

Through a spokesman, Gov. Ralph Northam, D, signaled he would veto the measure if it reaches his desk.

"The governor is ready to work with the General Assembly to promote responsible gun ownership, but he does not believe more guns in more locations is a solution to the real problem of gun violence," Northam spokesman Brian Coy said.

State law prohibits carrying "any gun, pistol, bowie knife, dagger or other dangerous weapon, without good and sufficient reason, to a place of worship."

In 2011, then-attorney general Ken Cuccinelli, R, issued an opinion that the ban would not apply to someone with a concealed carry permit, Sen. Chap Petersen, D-Fairfax, noted during an extended debate.

"Attorney generals come and they go," Chafin replied, suggesting that worshippers could not rely on that opinion as legal protection if they carried a gun to church. He contended that under the current law, places of worship could not station armed security guards in their buildings.

Sen. Jeremy McPike, D-Prince William, offered what he said would be a better solution. He wants to ban worshippers from carrying weapons unless they have authorization from the house of worship. He sponsored a bill to that effect, but it died in a Senate committee last week.

Chafin said that if passed, churches could still choose to ban weapons from their premises.

Petersen, an attorney who has represented churches in litigation, warned that churches, mosques and synagogues would be plunged into great controversy if guns became an option.

"Trying to decide whether you pass the collection plate from the left side or the right side is often times an issue of controversy," he said. "We've got plenty of issues already."