A court room on the third floor of Sacramento Superior Court is where people come seeking their guns back. It’s called the firearm calendar, but many people simply refer to it as gun court.

People who find themselves on the firearm calendar however, aren't criminals.

Under California law, people who are deemed a danger to themselves or others can be placed on what is called a 5150 hold. The 5150 number comes from a section of the state welfare law pertaining to involuntary psychiatric placements at a psychiatric facility. People held under those conditions also lose their rights to own a firearm in California for five years.

Of course the second amendment makes the right to bear arms a constitutional right. That's where gun court comes in. A judge can restore firearm rights and return guns which were seized by police for safekeeping during 5150 calls.

An ABC10 investigation of Sacramento’s gun court found some judges return more guns than others.

California’s 5150 firearm prohibition was enacted following a horrific mass shooting at a Stockton’s Cleveland Elementary School in 1989. Five children were killed and 32 people were wounded.

The gun in the Stockton shooting was purchased legally by the killer, Patrick Purdy, days before the crime, despite the fact that Purdy had a long history of psychiatric problems and a violent past.

According to violence prevention expert Amy Barnhorst, a UC Davis Psychiatrist, the firearm prohibition system for some mentally ill people in California is an imperfect, yet valuable tool.

“Substance abuse, alcohol use, past history of violence, domestic violence, people in those groups, we know their risk of violence has increased,” Barnhorst said.

"These people are not criminals, they have constitutional rights” said Judge Donald Currier, the current sitting judge in firearms court. “Most have had a very difficult time, there was something in their life, some kind of emergency crisis that led to their being placed on seventy-two hour hold.”

Currier is no stranger to guns, he was a U.S. Army general in Iraq and led 25,000 California National Guard troops. The judge said he is a staunch believer in the right to bear arms. Still, an examination of Currier’s cases shows he rarely agrees to restore gun rights or return weapons seized by police. When he does so, he says it’s very carefully.

"I just follow the law, and the law tells me that public safety is the number one concern. So in my decision making, public safety is the number one concern," Currier said.

One of Currier's predecessors, Judge David De Alba, who had a rotation in firearm court from 2011-2013, returned far more guns and overturned more firearm prohibitions than his successors, according to an analysis by ABC10.

In 2013 for example, De Alba’s last year in gun court, De Alba restored the overall right to own guns in California to sixteen individuals. In 2015 Judge Currier restored firearm rights to just five people.

City police departments also come to firearms court seeking permission to destroy guns they have seized during 5150 calls. ABC10 found that Judge De Alba was more likely to block those requests and instead order guns returned to individuals.

Between 2011-2013, in cases brought by the Sacramento City Attorney seeking to destroy seized weapons, Judge De Alba denied the petition and ordered guns returned eleven times. Since 2014, after De Alba left his gun court assignment, that court has not once ordered the City of Sacramento to return guns to people involved in 5150 cases.

Judge Currier has allowed some guns to be transferred to gun dealers so people who have guns taken away suffer less of a monetary hit.

Judge De Alba, who is still a Sacramento County Superior Court Judge, declined an interview with ABC10 to discuss specific cases.

ABC10 found over a half dozen rulings by De Alba which appeared eyebrow raising.

In one ruling, De Alba ordered the return of a repository of guns and rifles to a Citrus Heights man, Gerald Michael Thompson.

In January of 2013 Citrus Heights Police got a call from a teenager saying a disturbed man in a home was threatening suicide. It was the second police visit to the home that day. They had responded earlier for a domestic dispute.

When police arrived their report said that “children ran out of the house and came towards officers.” Thompson, according to police, admitted taking methamphetamines and having not slept in days. Thompson was placed on a 72 hour hold and brought to a psychiatric hospital.

Police seized two semi-automatic handguns and six rifles. The officer who wrote the report said in his judgement “I believe there would be a strong possibility of potential injury to Thompson or others if the confiscated weapons are returned.”

In August, 2013, De Alba ordered all those guns returned to Thompson.

Responding to ABC10’s questions about the case, a spokeswoman for Citrus Heights Police said, “The court held a contested hearing to determine whether the weapons should be returned to Mr. Thompson. Judge De Alba concluded that Mr. Thompson was not a threat to himself or others, reinstated Mr. Thompson’s right to possess firearms, and ordered that CHPD return the weapons.”

Citrus Heights police told ABC10 that Thompson never actually picked up the firearms and that they are still holding them in storage.

Though if he attempted to do so now, Thompson would have to answer for a warrant for his arrest.

The warrant relates to a troubling charge made by Sacramento’s District Attorney in December 2013, just four months after Judge De Alba declared Thompson not a danger. The DA alleges that Thompson secretly took nude photos of a teenager through a bedroom and shower window and that the photos were then put on a Facebook photo album. DA spokeswoman Shelly Orio said “there remains an active warrant” for Thompson.

In another troubling case, a Sacramento man, Michael Butler, obtained an order from Judge De Alba telling Sacramento police to return an assortment of seized weapons. The order came despite a police report which described a troubled man who casually left rifles strewn around the house "in easy access of minors."

Police picked up Butler in 2011 and placed him in a 5150 psychiatric hold after a call came in that alleged Butler was walking around naked and "threatening everyone," including his girlfriend and a 13 -year-old boy.

When police arrived, Butler had his “fist clenched,” and “appeared to be in a daze,” according to police reports. They seized an assortment of semi-automatic rifles and guns. Police also took "a pistol grip to an illegal AR-15 style rifle,” according to court documents.

One woman with first-hand knowledge of the harm that can come from some mentally ill people who possess guns said she is troubled by some of De Alba’s decisions.

“I hear that this is a problem all over the state. In the end, this is going to come down to the judge,” said Amanda Wilcox who lost her 19-year-old daughter Laura Wilcox in a shooting at a mental health clinic in Nevada City in 2001. Laura was a volunteer at the clinic.

The killer in the Nevada City shooting spree, Scott Thorpe, owned a dozen legally purchased guns, including one he used in the shooting. Thorpe owned the weapons despite a history of psychiatric issues and worries about his potential to commit violent acts by staff at the clinic. One case worker had, according to Wilcox, even suggested the county issue a restraining order against Thorpe because he was stalking her. But her superiors rejected the idea because they thought it could make things worse.

After the mass shooting Nevada County officials apologized at a town meeting and in a statement, saying they could have done more to prevent the tragedy.

Wilcox has gone on to champion both gun control and more treatment for the mentally ill. In 2003, she helped pass California’s Laura’s Law, named for her daughter. That law requires, in some instances, that mentally ill people who could pose a danger be required to receive outpatient treatment.

Wilcox was also a key figure behind the “gun violence restraining order” which went into effect in California on January 1st. The measure provides another tool to help take guns away from dangerous people. The law allows family members or other concerned parties to petition a judge to take away an individual’s gun rights for a year.

Wilcox had a message for judges considering returning firearms; be careful. “Judges in particular need to be very aware of the dynamic of mental illness. It is very episodic.”

And Wilcox repeated a message she often tells lawmakers. “You can always give a gun back, but you can’t get a life back.”