Mara W. Elliott is the elected City Attorney of San Diego.

Semiautomatic AR-15s for sale on Feb. 15 in Orem, Utah. (George Frey/Getty Images)

Mass shootings like the one in Parkland, Fla., are inevitably followed by emotional, heated debate. How do these massacres happen? Who is at fault? How can we prevent them while upholding the Second Amendment? As often happens, legislation stalls, the conversation cools amid other pressing issues, and the public is left feeling powerless.

One policy idea, though, is being met with rare consensus by both advocates for gun control and gun rights: gun violence restraining orders (GVRO), in which law enforcement agencies, families and household members can quickly remove firearms from individuals deemed unstable or unfit to own them. Americans interested in preventing gun-related violence should know that this common-sense tool is working in California.

In just the past few months, prosecutors in my office have obtained GVROs against 15 gun owners, each of whom a court determined posed a serious danger to themselves or others. Some of the respondents have a mental illness; others made public threats to kill.

There is no way to know how many lives we may have saved, but here is a recent example of how a GVRO protected the public:

Employees of an automobile dealership in San Diego had become increasingly disturbed by a co-worker’s behavior. After the mass killing in Las Vegas in October, this service adviser praised the shooter for not committing suicide until he had gunned down enough victims to set a modern record.

“If I were him,” the service adviser volunteered, “I would have shot up a mosque and then shot it out with cops.”

Not long after, he boasted that if he were fired by the car dealership — a prospect that seemed likely — he would return with his gun. An alarmed co-worker notified police and statements were taken. My office obtained a GVRO, and the man surrendered a semiautomatic rifle with significant killing capability.

The California Legislature created the GVRO statute in response to the 2014 mass killings in Isla Vista, a college community abutting the University of California at Santa Barbara. It can be used by a law enforcement agency, a family member or a housemate.

A court-issued GVRO compels an unfit gun owner to sell or surrender his firearms before he can do harm to himself or others while ensuring the gun owner’s right to due process. It provides police and citizens who witness danger signs with a powerful legal resource to save lives.

My office has been aggressively pursuing GVROs on behalf of our communities. Each case was documented and brought to us by the San Diego Police Department; no GVRO is permanent until it is granted by a judge during a hearing in open court.

The idea of approaching potentially violent people and demanding they turn over their firearms might sound like a disaster waiting to happen, but we have not had trouble enforcing the orders, in part because of the involvement of the San Diego Police Department and the California Department of Justice. (Law enforcement officers are present when we serve the restraining orders, and they collect the firearms and ammunition.) Many times, respondents do not contest the order. One told police, upon surrendering his guns, that he shouldn’t be allowed to have them. He had been drunk — intoxicated at three times the legal limit — and shooting at rats and raccoons in his suburban back yard. Terrified neighbors heard bullets whizzing through their trees.

Although each case is different, they share a common thread: The gun owner’s behavior was irresponsible and potentially lethal, echoing countless news reports of similar situations in which shots were fired and lives were lost. Take that drunken target shooter firing away in his densely populated neighborhood: How often have you heard of a recklessly fired bullet penetrating a wall and killing a child?

In one case, my office petitioned the court for a GVRO after a man had texted his fiancee, threatening to shoot her in the head, and visited her ex-boyfriend, vowing to kill him, too. After the order was granted, the California Department of Justice served a search warrant on the man’s mother, with whom he lived, and seized a handgun and an AR-15, the semiautomatic rifle used by mass shooters in Parkland; Las Vegas; Newtown, Conn.; Las Vegas, and San Bernardino, Calif.

Another respondent was an 81-year-old man who, according to his family, is in the early stages of dementia. He threatened to shoot his 75-year-old wife and their neighbor because he erroneously believed they were having an affair. His wife escaped the house, barefoot, by climbing over a fence and running through a cactus garden.

The most armed respondent was a 35-year-old man whom police encountered after he inflicted a deep laceration on his girlfriend’s forehead. He had a long history of domestic violence and an arsenal that included a 9mm pistol, a Mosquito semiautomatic pistol, a Ruger .22, a Springfield .40 caliber pistol, a Ruger rifle, a Mossberg shotgun and an unmarked handgun.

Some respondents have wielded guns while threatening suicide; one did so because he believed strangers were attacking him. A 23-year-old ex-Marine had developed an intense paranoia, which he exhibited first at a 7-Eleven, and then in the waiting room of an auto-parts store. Concerned for his life, he retrieved a pistol from his car, loaded it, tucked it into his waistband and returned to the waiting room, where he called police to report that he was in a dangerous situation and needed protection. His pistol was a model that fires high-velocity rounds, similar to a rifle.

A “permanent” GVRO expires after 12 months, time in which the gun owner can seek professional counseling or treatment to address underlying problems. Courts can authorize an extension of the GVRO if the gun owner remains unfit. Many Second Amendment advocates recognize that this approach strikes a good balance and that responsible gun owners should have nothing to fear.

Although GVROs are only one tool to combat our nation’s epidemic of senseless killings, they are especially valuable at a time when our federal government seems incapable of addressing the growing problem of gun violence in our schools and communities. The question of how to handle gun violence is a difficult and controversial one, but laws such as California’s GVRO are proving that effective and balanced solutions exist.

Correction: An earlier version of this post incorrectly described the type of pistol involved in a GVRO case.