Updated

California will become the first state that allows family members to ask a judge to remove firearms from a relative who appears to pose a threat, under legislation Gov. Jerry Brown said Tuesday he had signed.

The bill was proposed by several Democrats and responds to a deadly rampage in May near the University of California, Santa Barbara.

Relatives of the victims and other supporters of the bill said the parents of 22-year-old Elliot Rodger were thwarted in their attempts to seek help for their troubled son before the rampage.

Supporters had said such a measure could have prevented the attacks, winning out over critics who said it would erode gun rights.

"If both of these laws had been in place on May 23, things could have been very different," Rodger's father, Peter Rodger, said in a statement Tuesday night. "California, today, is a safer state because of this legislation. Let's hope other states follow."

Law enforcement authorities in Connecticut, Indiana and Texas can seek a judge's order allowing them to seize guns from people they deem to be a danger.

The new California law gives law enforcement the same option and extends it to family members.

It continues California's efforts to lead the nation in preventing firearm injury and death, said Amanda Wilcox, an advocate for the Brady Campaign to Prevent Gun Violence, whose daughter was a victim of gun violence.

The greatest effect might be in preventing suicides or intervening where there is a history of domestic violence, she said.

"It's hard to know how much it will be used or how much it will prevent," Wilcox said. "It only takes avoiding one loss for this to be worth it."

Lawmakers approved the bill by Democratic Assembly members Nancy Skinner of Berkeley and Das Williams of Santa Barbara amid pleas that they act after the May 23 attack in which six people were fatally stabbed or shot and 13 others wounded in the community of Isla Vista.

Weeks before that shooting, Elliot Rodger's parents had his therapist contact Santa Barbara County mental health officials. Sheriff's deputies talked to Elliot Rodger but never entered his apartment or checked to see if he owned guns.

They decided he was not a threat to himself or others and took no further action.

Elliot Rodger later wrote that had deputies searched his room, they might have found guns that police said he used to shoot three people after stabbing to death three others. Elliot Rodger killed himself while being pursued by police.

Under the California bill, whoever seeks the restraining order would have to sign an affidavit under oath. If they lie, they could be charged with a misdemeanor.

A court hearing would be held within 14 days after the restraining order is granted to give the gun owner a chance to argue there is no danger.

Republican lawmakers and some Democrats voted against the measure, known as AB1014.

In Elliot Rodger's case, there is no evidence his parents or anyone treating him knew he had weapons. That prompted Sen. Hannah-Beth Jackson, D-Santa Barbara, to introduce a related bill that would require law enforcement to develop policies that encourage officers to search the state's database of gun purchases as part of routine welfare checks. That bill, SB505, also was signed by the governor.

Brown's signing of the bills "helped to honor the life of my son, Christopher, and so many others killed by senseless gun violence," said Richard Martinez, father of Isla Vista shooting victim Christopher Ross Michaels-Martinez and an advocate for the group Everytown for Gun Safety.

"Nothing we can do will bring back Christopher, but I'm confident this new law will help save lives and prevent other families from experiencing this same kind of tragedy. States around the country should be exploring this life-saving measure," he said in a statement about the restraining order legislation.

Currently in California, authorities can seize legally purchased guns only from people convicted of a felony or a violent misdemeanor, people subject to a domestic violence restraining order or those who are determined to be mentally unstable.

The National Rifle Association and other gun-rights groups opposed the restraining order legislation.

"Our concern is not so much what they intended to do; our concern is with the method they put in place to address people with mental or emotional issues," said Sam Paredes, executive director of Gun Owners of California. "We think this just misses the mark and may create a situation where law-abiding gun owners are put in jeopardy."