Gov. Jerry Brown signed into law a landmark gun control bill Tuesday making California the first state in the country to allow those who suspect a close relative might pose a threat to seek a restraining order that would confiscate any firearms.

The bill was introduced in response to a deadly rampage near the UC Santa Barbara campus on May 23 that left six students and the killer dead and 13 injured.

See also: Women Play a Surprising Role in Mass Shootings

The new law allows immediate family members or law enforcement officers to approach a judge for a so-called "gun violence restraining order," which would temporarily confiscate guns from someone they believe may pose a danger to their self or others. The restraining orders can last up to 21 days and a hearing must be held within 14 days, at which point the term of the restraining order can be extended to up to a year.

Family members of Isla Vista killer Elliot Rodger had reported their concerns to Santa Barbara law enforcement after the 22-year-old posted videos of himself threatening violence online. In response, Santa Barbara County Sheriff's deputies visited Rodger's apartment just three weeks before the murders to perform a routine police procedure known as a "welfare check."

In a press conference held just after the killings, Santa Barbara County Sheriff Bill Brown said deputies who visited Rodger's apartment that night found him to be polite and amenable. Brown admitted that at the time, officials were not aware of Rodger's three legally owned handguns and had not viewed the videos in question.

Another piece of legislation signed into law Tuesday requires law enforcement agencies to enact new rules that encourage officers to consult the state's database of legal gun purchases when performing a welfare check of someone who may be at risk of violence. The exact policies are to be determined at the local level based on what practices they think best ensures public safety, a spokesperson for Sen. Hannah-Beth Jackson, the Santa Barbara Democrat who introduced the law, told Mashable.

Jackson said that while the law would not have given officers the legal authority to seize Rodger's guns, it could have opened a door to further action.

"Law enforcement could potentially have asked Rodger what he intended to do with the guns, asked to see the guns or asked him to voluntarily surrender the guns," Jackson said in a press release.

Under current California law, officers are only allowed to confiscate weapons if their owner has been convicted of a violent crime, deemed mentally unstable or is subject to a restraining order for domestic violence. Connecticut, Indiana and Texas all have laws in place that allow police to seize firearms with a judge's order, but California is the first state to extend this right to immediate family members.

Democratic Assembly Member Das Williams of Santa Barbara, who introduced the bill into the assembly along with fellow democrat Nancy Skinner of Berkeley, said giving the power to get a gun violence restraining order to family members is a key feature of the law that will also help combat cases of suicide.

"When it comes to recognizing the signs of impending violence, whether self-directed or aimed at others, family members have unique insight into an individual," Williams said in a statement. "Especially in cases where a person has no prior criminal record or documented mental health history, the context provided by someone who has known that person for years can be critical."

Family members of three of the students killed in Isla Vista publicly voiced support for the bill in an open letter to legislators.

"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," Richard Martinez, father of 20-year-old Christopher Michael-Martinez, said in a statement.

Martinez spoke at a press conference held at an Isla Vista park along with Williams, Jackson and other supporters on Tuesday to commemorate the new law.

The bill faced opposition from several gun rights advocacy groups including the National Rifle Association, California Rifle and Pistol Association, Gun Owners of California and the Calguns Foundation.

"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," Sam Paredes, executive director of Gun Owners of California, told the Associated Press. "We think this just misses the mark and may create a situation where law-abiding gun owners are put in jeopardy."

In addition to the two laws, Brown vetoed a bill that would have required homemade firearms, such as 3D-printed guns, to be registered with the Department of Justice and passed another law requiring pellet guns or toy guns to be brightly colored. The bill was introduced in response to an incident in which a 13-year-old boy was shot and killed by a sheriff's deputy who thought the pellet gun he was carrying was an assault rifle.

"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."