A federal judge on Monday ordered a man with a violent criminal past to be held without bond for threatening to kill President Obama, according to court records.

During a hearing in Cheyenne on Monday, Chief U.S. District Court Judge Nancy Freudenthal also ordered David Dwayne Perry to undergo a mental competency evaluation.

A preliminary hearing for Perry will be set after the evaluation is completed.

Federal authorities arrested him late last week after a report that he placed a call from the Cheyenne Regional Medical Center to the Cheyenne police dispatch center on Jan. 24.

Perry reportedly told a dispatcher, "'I'm gonna bomb the White House and I'm gonna kill Obama," according to the affidavit by U.S. Secret Service Agent Rick Near.

The lead mental heath case manager at the medical center told Near that Perry also threatened to kill the hospital's inpatient behavioral health staff when he was released.

Perry declined to be interviewed by the agent because he wanted an attorney present.

The Wyoming U.S. Attorney's Office asked Freudenthal to order a pretrial detention for Perry because the case involves a crime of violence, the defendant is a flight risk, and the safety of the community.

If convicted, Perry could spend up to 10 years behind bars, according to the criminal complaint.

Freudenthal also granted the U.S. Attorney's request that Perry undergo a psychological or psychiatric evaluation and competency hearing because he may be mentally ill and incapable of understand the nature and consequences of the case against him.

Shegranted that request. Perry's evaluation is scheduled to be completed within 45 days, according to her order.

Perry has an extensive violent criminal history dating back to 1999, including at least one felony conviction for assault with a deadly weapon, according to the U.S. Attorney's Office.

"This history also shows a 'diagnostic commitment up to 90 days' in the California Department of Corrections in 1999, and separate harassment and assault charges which were dismissed-reason of competency' in Seattle Washington, in 2014," according to the request for the mental evaluation.