A Maryland man accused of running through the U.S. Capitol with a loaded handgun appeared in court Tuesday but will undergo days of psychiatric evaluation and treatment before his arraignment.

Federal prosecutors said Carlos Greene, 20, should be considered a flight risk because he was on parole for assaulting a police officer and on probation in Maryland for unspecified charges. Magistrate Judge John M. Facciola ordered Greene held until a hearing Friday.

Greene, from Silver Spring, Md., spoke only briefly, thanking the judge on his way out of the courtroom.

Prosecutors said Greene led police on a car chase and nearly hit two pedestrians Monday before crashing on the Capitol grounds. After a foot chase through the Capitol, he tried to grab a shotgun from a police officer before being subdued, authorities said.

Police said he had a loaded handgun and crack cocaine when he was arrested.

It was the worst breach of Capitol security since a gunman killed two police officers in 1998.

Greene friends and family who came to court said the case was being overblown. They said he probably was intoxicated and didn't know what he was doing.