Guns could be confiscated from the mentally ill in New Jersey under legislation set to be introduced Thursday by State Sen. Dick Codey (D-Livingston).

David McNew, Getty Images

Under the measure, a mentally unstable person would be temporarily prohibited from buying and possessing firearms after family, partners or friends call police.

Police could then request that a judge grant a restraining order that could bar the possession or purchase of a gun for a period of time. The restraining order would be reassessed after that period, and the judge would then rule whether it should be lifted or not.  The period of time would be determined by the judge.

"If someone is mentally ill and clearly in need of help -  if they refuse to get that help - you need some kind of legal mechanism to have their guns taken away from them so they won't harm themselves through suicide, or  (harm) others.  Unfortunately innocent people have lost their lives so this is that mechanism," Codey said.

In New Jersey it's very difficult for a mentally unstable person to legally buy a gun, but taking away their firearms post-purchase often requires that the person is involuntarily committed to a mental institution.

"We want to be able to have these loved ones say, 'Hey listen, I see this. I live it. Get these guns away from our son or our daughter. Do it now,'" Codey said.

In California a similar bill was introduced after 22-year-old Elliot Rodger allegedly killed six people on May 23 before killing himself. Law enforcement officials visited Rodger's home less than a month before the murders because loved ones became concerned about his mental health. Police didn't intervene because Rodger didn't meet specific criteria.

"In our nation, we are seeing these mass murderers who clearly exhibit signs of being mentally ill and prone to violence," Codey said.