Last year, a man who worked at a car dealership in San Diego told his co-workers that he would shoot up the place if he were fired, and he praised the man who had carried out the Las Vegas massacre.

Another man told his fiancée he wanted to shoot her in the head, and also threatened to kill her ex-boyfriend. Still another told co-workers that he wished his supervisors would die, and that he could invite them hunting so it would look like an accident.

In all three cases, the men owned firearms. In all three cases, those weapons were taken away after the San Diego city attorney obtained a gun violence restraining order, a measure that the authorities or relatives can request from a judge to temporarily remove firearms from people deemed to be a threat to themselves or others.

California is one of 17 states with a “red flag” law authorizing those kinds of orders. Most of the laws were passed after the February 2018 massacre in Parkland, Fla., where a 19-year-old man used a semiautomatic assault weapon to kill 17 students and others.