Proposals for a federal law encouraging the removal of guns from people at risk of harming themselves or others have gained a rare measure of bipartisan support after back-to-back mass shootings last weekend in Texas and Ohio.

But the experiences of states that have adopted similar measures show that the effects of such “red flag” laws have been widely uneven, depending on legislative fine print and the energy with which frontline law enforcement officials choose to implement them.

Researchers and law enforcement officials say some gun confiscations under red-flag laws may have stopped mass shootings. Of the 17 states that have adopted such legislation, in addition to the District of Columbia, some are now seeing hundreds of firearms removed annually from people who have threatened suicide or murder.

But others — including some jurisdictions with fierce political support for gun restrictions — have seen underwhelming results. California’s law went nearly unused for two years after its passage in 2016. Not a single request for a gun to be removed has been filed under the D.C. measure, which took effect at the beginning of this year.

That history suggests that a national law that spurs more states to take away guns from those who present a risk could yield incremental, rather than sweeping, results — and that success could hinge on the enthusiasm with which local officials embrace the measure.

“The idea behind it is really strong,” said Mark Rosenberg, who formerly oversaw gun violence research at the Centers for Disease Control and Prevention. “The idea behind it says, ‘Take guns away from the people who shouldn’t have them, the people who are great risks to themselves and others, without interfering with the rights of law abiding gun owners.’ ”

But in practice, Rosenberg said, much depends on the details of the laws and how they are implemented.

Red-flag laws typically allow petitions to a judge to temporarily remove a gun from someone believed to be dangerous. A temporary confiscation order is usually followed by a hearing at which the judge weighs barring the person from having a gun for a longer period.

In Florida, Rhode Island and Vermont, only law enforcement officials can petition for gun-
removal orders, according to the Giffords Law Center to Prevent Gun Violence. Roughly a dozen states have adopted laws that empower household members to seek the petitions, while a few states also allow mental-health workers to do so.

Maryland and the District offer a compelling case study in how similar versions of a red-flag law can yield dramatically different results.

In the 10 months since its law took effect, Maryland has fielded 788 petitions for gun removal, and judges have granted more than 400, according to state data. In the District, where Mayor Muriel E. Bowser (D) and Police Chief Peter Newsham spoke out against parts of the law before its passage by the D.C. Council last year, no petitions have been filed in the seven months they have been available.

Montgomery County Sheriff Darren M. Popkin, who sat on a working group that helped develop Maryland’s policy, said an intensive effort to train police officers and sheriff’s deputies on using the orders was one ingredient of the law’s rapid acceptance.

Such training is especially important, he said, because police officers are often the ones seeking gun-removal orders. Family members may call 911 and even serve as witnesses in a court hearing that leads to confiscation, but are often unwilling to directly file a petition themselves, Popkin said.

“After the order is enforced, you’re still living with that person,” he said. “It sometimes gets a little bit difficult and awkward for that person to have that dynamic.”

Kevin Donahue, D.C. deputy mayor for public safety, said police have not slow-walked the implementation of the new law, which Newsham criticized for a provision that offers immunity from prosecution for illegal firearms possession.

Donahue said city officials are still developing an outreach campaign, protocols for training police on the new law and guidelines for how officers should educate people about the option for an emergency order when responding to calls related to guns or domestic violence — as officers in other states do. He said crafting such policies is more complicated in a city where many guns are not lawfully owned.

“I think the law is going to have a positive impact,” Donahue said, while cautioning that “people need to calibrate and temper expectations in a city where most firearms are illegal.”

The Maryland data suggests that red-flag laws may see less eager receptions in high-crime cities. Despite having the state’s highest homicide rate, the city of Baltimore generated only 29 petitions over the first 10 months of the law’s implementation. Anne Arundel County, with a smaller population, saw 128 petitions over the same period.

But Charles Allen (D-Ward 6), a D.C. Council member and chairman of its judiciary committee, expressed frustration at what he said was the unacceptably slow implementation of the D.C. law.

“Lives are literally at stake,” he said. “I don’t think we should be spending month after month to get the word out.” Pointing to the number of petitions filed in Maryland, he added, “It’s amazing what happens when you let people know about it.”

In California — which, like the District, has some of the nation’s strictest gun-control laws — a red-flag law was barely noticeable during the first two years after it took effect. In a state of nearly 40 million residents, there were 10 or fewer petitions typically filed per month for 2016 and much of 2017, said Garen Wintemute, director of the Violence Prevention Research Program at the University of California at Davis.

“I think a fundamental problem was that law enforcement and the public just weren’t aware it existed,” Wintemute said. By the end of 2017, he said, as outreach efforts and publicity increased, the monthly number of petitions grew to roughly 40 per month.

Wintemute, whose researchers are preparing to publish a study on the California law’s effects, said that most petitions have been requested by law enforcement officers and that many involve people at risk of harming themselves rather than others.

That is in line with findings from other parts of the country, where research has suggested that similar laws may cut suicide rates. A study published last year found that red-flag measures were associated with a 13.7 percent drop in the gun suicide rate in Connecticut and a 7.5 percent reduction in Indiana.

But Wintemute said his team has also identified more than 20 cases in which an order was used as part of an effort to prevent a mass shooting.

“None of those mass shootings occurred,” he said. “Now, I can’t say that the order’s responsible, but I take that as suggestive that this very tightly focused intervention may be of value in the types of high-risk situations that have riveted the country’s attention this week.”

In Montgomery County, a red-flag petition was used last October in the case of a Rockville teenager who threatened on social media to “shoot up” Walter Johnson High School, Popkin said.

Yet even in states where red-flag laws are actively applied, killers slip through the cracks.

The Sandy Hook Elementary School shooting took place in Connecticut, which is frequently cited for successfully implementing its red-flag law. California’s law was in active use by the time a massacre took place at a bar in Thousand Oaks last fall.

Gun-rights advocates have also criticized the laws, saying they could bypass due process. Mark Pennak, president of the Second Amendment advocacy group Maryland Shall Issue, said red-flag measures give too much weight to the accuser and allow police to seize guns from people who have not committed a crime.

“It seems to me an awful lot of constitutional issues and an awful lot of risk, and not a lot of gain,” Pennak said.

Federal red-flag legislation has nevertheless gained momentum in recent days, as lawmakers in Washington desperately seek a response to mass shootings that could gain support from both political parties. Sens. Lindsey O. Graham (R-S.C.) and Richard Blumenthal (D-Conn.) are pushing a bipartisan proposal creating a federal grant program that offers funding for states to enact red-flag programs.

A Washington Post-ABC News poll last year found that more than 8 in 10 Americans supported allowing police to take guns from people if a judge determines they are a danger to themselves or others. Even the National Rifle Association signaled openness to such laws after a mass shooting last year at Marjory Stoneman Douglas High School in Parkland, Fla.

Kyleanne Hunter of the Brady Campaign and Center to Prevent Gun Violence said that for a federal government that has been loath to tackle gun violence, the approval of legislation that expands red-flag laws would be a step in the right direction — but only a first step.

“The big push has to be not just to pass these laws,” Hunter said, “but to implement them well and communicate very effectively about them.”

Scott Clement, Erin Cox and Dan Morse contributed to this report.