By Sharon Bernstein

SACRAMENTO Calif. (Reuters) - People who fear a close relative may commit gun violence will be able to petition a judge to temporarily remove the person's firearms in California, under a bill signed into law on Tuesday by Democratic Governor Jerry Brown.

The legislation - the first such measure in the United States - was introduced after police in Isla Vista near Santa Barbara said they were unable to confiscate weapons from a man who later went on a rampage and killed six people, despite concern from his family.

"In the case of the Isla Vista shooter, Elliot Rodger, his mother was noticing that he was becoming more agitated and making these threats of violence, but there was little she could do and little the police could do," said Democratic Assembly member Nancy Skinner of Berkeley, who introduced the bill along with Santa Barbara Democrat Das Williams.

Under the so-called gun violence restraining order in the court system, immediate family members and law enforcement agencies could ask a judge to order guns temporarily removed from certain individuals.

The restraining order would last 21 days, and could be extended up to a year, after a notice and a hearing.

"The new 'Gun Violence Restraining Order' law will give families and law enforcement a needed tool to reduce the risk of mass shootings and gun violence both in the home and on our streets," said Nick and Amanda Wilcox, legislative co-chairs of the California Chapters of the Brady Campaign to Prevent Gun Violence.

The law has wide support from law enforcement agencies and is based on an existing measure that temporarily blocks people with domestic violence restraining orders from owning a gun.

"If it can save one life, one family from that agony, it will be worth it," Democratic state Senator Hannah-Beth Jackson, said during debate on the measure.

Critics said the bill infringed on the Second Amendment right to keep and bear arms.

Brown also signed a bill on Tuesday requiring BB guns and pellet guns to be brightly colored or otherwise marked so that law enforcement officers do not mistake them for deadly firearms.

Story continues

The bill was introduced after a 13-year-old Northern California boy was shot and killed by a sheriff's deputy while carrying a pellet gun that looked like an assault weapon.

The law also expanded the definition of a BB gun in California to include firearms that shoot pellets larger than 6 millimeters.

(Reporting by Sharon Bernstein; Editing by Peter Cooney and Sandra Maler)