A 21-year-old Idaho man who allegedly called US President Barack Obama the "devil" and the "anti-Christ" was charged with attempting to assassinate him by firing shots at the White House.
Oscar Ortega-Hernandez was arrested by Pennsylvania state police on Wednesday following last week's shooting incident at the presidential mansion in Washington, one of the world's most closely guarded buildings.
Obama and his wife Michelle were in California at the time of the incident, and no one was injured.
Ortega-Hernandez was charged in US federal court in Pittsburgh, where a judge ordered that he remain in police custody, the official said. He could face a maximum sentence of life in prison if convicted.
He was arrested at a hotel near Indiana, Pennsylvania, after gunshots were heard late last Friday near the White House, about 600 to 700 yards away on Constitution Avenue, Secret Service special agent Edwin Donovan said.
Within five minutes of the shooting, authorities located an abandoned vehicle on Constitution Avenue, which runs along the northern border of the Washington Mall. That car was found to be registered to Ortega-Hernandez.
According to the criminal complaint, investigators recovered a semi-automatic assault rifle "with a large scope mounted on the top portion of the weapon" along with ammunition and nine spent shell casings.
From Constitution Avenue, a shooter would have a clear line of sight to the White House, across the Ellipse and the South Lawn of the presidential mansion where Obama, his wife, their two daughters and the first lady's mother live.
Traffic is not restricted on Constitution Avenue and members of the public can approach the wrought iron fence at the bottom of the South Lawn on foot.
The suspect was due to be transferred "within a few days" to Washington, federal prosecutors said.