After a white supremacist discussed plans on Facebook for a mass shooting at a synagogue, police in Washington used a new law to quickly seize his 12 firearms, long before he was convicted of any crime.

But when a Tennessee father became alarmed about his son after receiving a suicidal text message, he said the police determined they could not take his son’s guns away. A few months later, the man showed up at a church and shot seven worshippers one Sunday morning, killing one.

Family members and police routinely face agonizing decisions when otherwise lawful gun owners reveal an impulse to harm themselves or others, and more states are enacting laws that let authorities take away their weapons.

With bipartisan support in many cases, 17 states and Washington D.C. have now passed “red flag laws” that allow the court-ordered removal of guns from people who are considered to be dangerous. The back-to-back shootings that killed 31 people this month in Texas and Ohio have given new momentum to proposals pending in several other states and to a plan in Congress to provide grant money to states that adopt such measures.

In a rare victory for gun control advocates, the laws have spread since the February 2018 shooting that killed 17 students and staff members at a high school in Parkland, Fla. New York’s new law took effect Saturday while New Jersey’s begins Sept. 1. The proliferation of such laws comes despite opposition from gun rights activists and others who say the measures go too far.

Since most of the laws are new, research on their effectiveness is limited. A study published last year estimated that the two states with the longest-standing laws, Connecticut and Indiana, may have had 500 fewer gun suicides over a decade as a result of the measures. Another study estimated that Connecticut, which adopted its law in 1999 after a mass shooting at the state lottery office, prevented one suicide for every 10 to 20 people subjected to gun seizures.

A study published this week about California’s law found 21 examples in which people who had threatened public shootings were successfully disarmed.

In jurisdictions where red flag laws have been aggressively enforced, officials say the measures have likely prevented some suicides, workplace shootings and domestic killings.

“I’m convinced that having this powerful tool gives our communities the ability to step in and prevent some tragedies from happening,” said Mara Elliott, the city attorney in San Diego, where more than 300 gun violence restraining orders have been issued in less than two years. “Given the numbers that we are seeing, I think that’s startling.”

She said the orders have been used to protect people from “all walks of life,” including students, employees, intimate partners, parents and children. Those disarmed by red flag orders include a man who made online threats of a mass shooting at a gay bar, a man who told a family member he was going to kill Muslims, and a man who made disturbing statements about guns and immigrants. To grant a final order under California’s law, a judge must find evidence that the person poses “significant danger.”

In Florida, courts have granted more than 1,800 risk protection orders since its law passed in March 2018, data shows. Other states report anywhere from dozens to hundreds of cases per year.

The state laws vary greatly, particularly over which individuals can petition for orders and the standard of proof they must show to be granted. And their enforcement differs by local jurisdiction, with cities like San Diego and Seattle and pockets of Maryland and Florida using them more aggressively than others.

Proposals in several states, including New Hampshire, Nebraska and Tennessee, have stalled after opposition from gun rights activists and, in some cases, divisions among law enforcement over whether they go too far.

Critics of the laws say they can result in the seizure of guns from law-abiding citizens based on thin claims of danger or false and exaggerated allegations. While many police chiefs have publicly supported red flag laws, other law enforcement leaders contend that they infringe on constitutional rights and will create an expensive new mandate to store guns. And the death of an officer who was shot by a suspect while serving a warrant last year under Maryland’s new law highlighted the danger to the police responsible for seizing firearms.

“It creates almost an instant situation of potentially deadly force, and you have to think, are we initiating that confrontation?” said Matt Barrall, vice president of the Nebraska chapter of the Fraternal Order of Police.

Barrall testified in February in favor of a red flag law in Nebraska. But he said his group has since revisited its position and may be less supportive in the future.

At the center of the debate are questions over whether the laws disarm truly dangerous people. Supporters say that the laws give people who are in mental distress time to cool off or get mental health treatment.

“It’s not going to work in 100 percent of the situations but I feel like it gives you that extra time,” said Marilyn Balcerak, who campaigned for the Washington law after her son killed his step-sister and himself in 2015. She had asked police whether she had any legal way to keep guns from her son after he had threatened suicide, but was told there wasn’t.

The threat to the Washington state synagogue came from Dakota Reed, who came to the FBI’s attention after the Anti-Defamation League reported a series of Facebook posts that threatened Jewish people last year. They included photos of Reed in his bedroom with firearms and Nazi salutes, posts that glorified other well-known shooters and repeated references to plans to carry out a mass shooting in the year 2025. “I’m shooting for 30 Jews,” Reed wrote in one.

Reed told police that he was just venting anger and trying to get attention with his Facebook posts, which he said were intended as fiction. But he continued posting slurs and threats while free on bond, including one in which he mused about taking a “grenade launcher” to a courthouse. By then, police had seized his assault-style rifle and 11 other guns after a judge signed an extreme risk protection order. In June, he was sentenced to one year in jail.

There was no red flag law in Tennessee before the September 2017 shooting at the Burnette Chapel Church of Christ. Advocates argue it’s the type of deadly event that the state could potentially prevent by passing the change.

Emanuel Samson’s father, Vanansio Samson, testified in court that he received a suicidal text message from his son in June 2017. The father said he then tried to convince authorities to take away Samson’s guns, but he said police responded by claiming they could not infringe on his civil rights. Police have said their report doesn’t show that request being made, and that officers deemed Samson OK when they checked on him.

Samson, who had a history of mental illness, killed a woman in the church parking lot before entering the building. Wearing a clown-design motorcycle mask, he struck six other worshippers in a spray of bullets and pistol-whipped another.

“If (police) had detained him and taken him for an evaluation that time, because I believe that sickness was out there, we would have not been sitting here today, or this tragedy would have not happened,” Vanansio Samson testified.

Emanuel Samson was convicted of murder and sentenced to life in prison without parole.