RICHMOND, Va. (WRIC) — The Virginia Senate passed a bill allowing judges to consider several factors before issuing substantial risk protection orders, also known as “red-flag” orders, that let police seize guns from those deemed a threat to themselves or others.

The legislation from state Sen. Scott A. Surovell (D-Fairfax) advanced to the Republican-controlled Virginia House of Delegates, where it is expected to be defeated, nearly along party lines Monday.

Senate Republicans who opposed the measure argued it would infringe upon the constitutional rights of gun owners and deny people’s due process.

Sen. Surovell responded that his bill would “provide clarity” to courts on issuing such orders, not expand the state’s “red-flag” law, and could have helped prevent recent mass shootings in Virginia, including the ones at the University of Virginia and a Chesapeake Walmart.

“This is not a Second Amendment issue and it’s not a partisan issue,” Surovell said on the Senate floor, adding that Republicans in the Congress have backed similar efforts.

Under the measure, a judge or magistrate would be able to consider a series of factors to determine probable cause to issue the order.

These include whether the person committed any violent acts or criminal offenses, made threats or used force resulting in injury to themselves or another at least six months before a petition is filed for the court order.

Judges could also consider whether the person violated the order, was arrested for stalking within six months of the filing, convicted of any offense that would prevent them from accessing a gun, or attempted or made a threat of suicide.

Other factors include whether there is evidence “of recent acquisition of a firearm or ammunition” by the person under the order, and whether they have committed criminal offenses or violent acts against animals six months before the petition is filed.

A provision in the measure would also allow judges to consider if the person showed “a pattern of violent acts or threats to another person, including any acts or threats made against family members, neighbors, co-workers, or toward schools or students or government buildings or employees” within a year of the petition.

Surovell pointed to the mass shooting at a Chesapeake Walmart last November, where an employee killed six of his co-workers with a legally-bought gun he got hours before, saying his proposal could have stopped the gunman. He said the bill was also designed to help reduce suicides, saying that suicides account for a majority of firearm deaths.

The bill passed on a 23-16 vote, with state Sen. Emmett W. Hanger (R-Augusta) joining the chamber’s 22 Democrats. The measure will go to the House of Delegates, where it is expected to be defeated.