RICHMOND, Va. -- The Virginia Senate has approved legislation that would allow authorities to take guns away from people deemed dangerous to themselves or others, as the state moves closer to joining a growing number of states enacting so-called “red flag” gun laws.

The Democratic-led Senate voted for SB 240 Wednesday despite fierce resistance from Republican lawmakers.

SB240, the so-called “red flag” law passes the VIrginia Senate 21-19. pic.twitter.com/7QwLuEfaNe — Cam Thompson (@CamThompsonCBS6) January 22, 2020

The bill would create a process for attorneys and law enforcement to file emergency orders prohibiting a person from purchasing, possessing or transferring a firearm if they pose “a substantial risk of injury to himself or others.”

Democrats said the bill could help prevent mass shootings and said similar laws have worked well in 17 other states. They added that the bill had been carefully crafted to preserve due process and protect individual rights.

“Shows that they have reduced the deaths in several states, particularly suicides, and also have been used in several situations of threats of mass shootings,” said Sen. George Barker (D-39th).

On the other hand, Republicans raised concerns about the impact of the bill on people’s rights and says it will create dangerous situations for law enforcement officers enforcing it.

“What we’re doing is going to undermine not only the Second Amendment rights but the right to due process of Virginians,” said Sen. Mark Obenshain (R-26th).

Meanwhile, Republican Senator Amanda Chase (R-11th) accused Democrats of disloyalty and said the proposed law would embolden criminals and hurt law-abiding citizens.

“Each legislator that votes in favor of this bill is, in my opinion, a traitor to Virginia, a traitor to the Second Amendment, and traitor to our constitutional freedoms,” said Chase.

Comments that Democrats say was deeply offensive and against the rules of the Senate.

“I would like her to know that I am deeply offended that she has accused anyone on this floor of treason,” said Sen. Janet Howell.

Democrats say they would not file a formal complaint since Chase admitted she had not read the rules in their entirety.

In response to concerns over due process, Democrats say they’ve worked with Republicans to address them, making 15 to 20 amendments.

“The bill that’s on the floor today is a whole lot more improved in terms of giving the accused person rights to fight back if they feel the order was entered unfairly,” said Sen. Scott Surovell (D-36th).

The move comes a two days after tens of thousands of gun-rights activists rallied peacefully at the state Capitol.

The Associated Press contributed to this report.