The mentally unstable Latino man accused of firing several rounds at the White House was charged with trying to assassinate the president or his staff.

Oscar Ramiro Ortega-Hernandez, of Idaho Falls, Idaho, made his first court appearance before a federal magistrate in Pittsburgh on Thursday, one day after he was arrested at a western Pennsylvania hotel. He will be taken back from a federal court in Pittsburgh to face the charges in Washington, D.C.

Ortega will remain in federal custody at least until a magistrate in Washington can determine if he should remain jailed until his trial on the charge, which carries up to life in prison.

Ortega sat quietly as the hearing began, his hands free but his feet shackled. The 21-year-old said only, "Yes, ma'am" when he was asked if he understood that he would be going back to Washington to face the charge. Ortega was arrested Wednesday afternoon at a hotel near Indiana, Pa., about 55 miles east of Pittsburgh, after a desk clerk recognized his picture. He had been reported missing Oct. 31 by his family.

Authorities say last Friday, Ortega pulled his car within view of the White House and opened fire, cracking a window of the first family's living quarters while the president was away.

Authorities are investigating Ortega's mental health and say there are indications he believed attacking the White House was part of a personal mission from God, according to a law enforcement official who spoke with The Associated Press. There are also indications the man had become obsessed with Obama and the White House, according to two officials, who spoke on the condition of anonymity because the investigation is ongoing.

On Thursday, the mother of his former fiancé said Ortega had always been well-mannered and considerate in the four years she had known him. In recent months, though, Ortega began making statements that were out of character, said Kimberly Allen, who lives in Shelley, Idaho.

She said Ortega told family he believed he was Jesus Christ and that the world was going to end. Allen said the family was worried when he went to Utah recently, where he said he had business, and didn't come back. She said they were "just flabbergasted" to hear he was wanted in Washington.

"I believe that the boy needs help," Allen said.

Allen's daughter, Jessica Galbraith, who was engaged to Ortega and is the mother of their 2-year-old son, declined to comment except to say: "I love him, and I'm here for him."

Investigators believe Ortega fired at the White House from his vehicle Friday, according to an official with knowledge of the investigation. Gunshots were reported that night on Constitution Avenue about 9:30 p.m. Soon after, U.S. Park Police found an abandoned vehicle, the assault rifle inside it, near a bridge leading out of the nation's capital to Virginia. The car led investigators to Ortega.

Agents discovered Tuesday that two bullets had hit the White House's exterior, one of them cracking a window on the second floor residential level, just behind the rounded portico visible from the south side of the White House.

That bullet was stopped by protective ballistic glass. The window that was hit is in front of the Yellow Oval Room, which is in the middle of the family's living quarters.

At the time of the shooting, Obama and his wife Michelle were on a trip to California and Hawaii. The president has since traveled to Australia and Indonesia on a nine-day tour. The Obamas' daughters, Malia and Sasha, were not in California, but the White House has not said if they were home at the time shots were fired.

This is not the first time the White House has come under attack.

In the last 40 years, the landmark has faced threats ranging from a stolen helicopter that landed on the grounds in 1974 to a man who wielded a sawed-off shotgun on a sidewalk outside in 1984. In 1994 alone, there were five threats including a plane crash on the lawn and a suspected drive-by shooting. Another man fired at least 29 rounds from a semiautomatic weapon, with 11 striking the White House.

Dan Bongino is a former Secret Service agent who served on the presidential details for Obama and President George W. Bush. He said Friday's shooting would likely mean tighter security and coordination.

"They do an exhaustive review of their security procedures every time something like this happens," he said. "Nothing ever works perfectly. They will undress this completely and then they will find out when they rebuild the incident exactly what they could have done better."

Bongino, who recently left the Secret Service to run for U.S. Senate in Maryland, said it was doubtful that a gunman could strike a target such as the White House from a moving car at the distance investigators suspect he shot. It would require "an incredible amount of training to pull that off," he said, suggesting it was more likely Ortega stopped his car to fire.

An official who spoke on the condition of anonymity because the investigation is ongoing said Ortega used a knockoff of an AK-47. Late Wednesday, however, authorities had not conclusively linked the gun to the rounds found at the White House.

In the days after the gunfire, police distributed photos of Ortega, including one that showed the word "Israel" tattooed on his neck, the name of his son. He had been stopped and questioned Friday morning just across the Potomac River from Washington in Arlington, Va. Arlington police said they stopped him after a report of suspicious behavior but released him after photographing him because they had no reason to make an arrest.

Subsequently, a U.S. Park Police crime bulletin said he was known to have mental health issues.

"Ortega should be considered unstable with violent tendencies," the bulletin stated.

Ortega was arrested Wednesday afternoon at a hotel near Indiana, Pa., about 55 miles east of Pittsburgh, the Secret Service said. A book bag he left behind when he was arrested, however, briefly caused a bomb scare because police initially didn't know who it belonged to.

State troopers said Ortega had visited the hotel in recent days, and investigators believed he was back in the area Wednesday. The Secret Service passed out photographs and a desk clerk recognized his picture.

Ortega was reported missing Oct. 31 by his family. A message left for Ortega's mother Wednesday at an Idaho Falls restaurant where she works was not returned. Phone listings for family members in the city were disconnected.

Ortega has an arrest record in three states but has not been linked to any radical organizations, U.S. Park Police have said.

Based on reporting by The Associated Press.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino