A federal judge on Thursday found a man not guilty by reason of insanity for threatening to kill President Obama in January, according to court records.

Chief U.S. District Court Judge Nancy Freudenthal ordered David Wayne Perry to a mental health facility after a bench trial in in Cheyenne on Wednesday.

"Perry will be in the custody of the mental facility until there is determination by clear and convincing evidence that his release would not cause a substantial risk of bodily injury to another person or serious damage to property of another due to his mental disease or defect," Freudenthal wrote.

On Jan. 30, federal authorities arrested him after a report that he called the Cheyenne police dispatch center on Jan. 24 and said, “‘I’m gonna bomb the White House and I’m gonna kill Obama,'” according to court records.

Freudenthal ordered a mental evaluation, which was submitted to the court on May 28, according to Freudenthal's order on Thursday.

On June 10, the court found he was competent to stand trial as long he as kept taking his medication. The court then arraigned him and he entered a plea of not guilty by reason of insanity.

On Wednesday, Perry waived his right to a jury trial and Freudenthal conducted the bench trial.

The court reviewed the psychologist's report that stated Perry was hospitalized in December and January at the Fairfax Psychiatric Center in Kirkland, Wash., where he started taking a drug for psychotic symptoms. He was released, and went to an emergency center in Seattle where he was prescribed a drug to treat schizophrenia.

However, Perry stopped taking it and instead started taking a steroid and was using heroin and methamphetamine. He became convinced cars were talking to him and someone was trying to kill him.

Perry bought a bus ticket, traveled to Cheyenne, and tried to find a shelter. However, no beds were available so he panhandled and used the rest of his heroin.

On Jan. 24, he went to the Cheyenne Regional Medical Center. Someone provided him a phone and he believed he heard Obama voice saying "'we are going to crucify you.'" Perry then called 911 and made his threat.

The psychologist wrote Perry functioned at a low average range of intellectual abilities, has good long- and short-term memory, but is severely mentally ill with a poor record of staying on his medications.

While Perry was aware of the nature of his actions, he was not aware of their wrongfulness. He was guided by delusional beliefs and auditory hallucinations because of his schizophrenia, according to the psychologist.

"Both the Government and Perry agree the appropriate disposition in this case is a finding of not guilty by reason of mental insanity," Freudenthal wrote.

More From K2 Radio