Ortega-Hernandez will be moved from a federal court in Pittsburgh to face the charges in Washington [GALLO/GETTY]

An Idaho man accused of firing two shots at the White House last week has been charged with attempting to assassinate US President Barack Obama or his staff.

Police arrested Oscar Ortega-Hernandez of Idaho Falls, Idaho, on Wednesday at a hotel in Pennsylvania, about four hours driving time from Washington, the US secret service said.

Ortega-Hernandez will be taken back from a federal court in Pittsburgh to face the charges in Washington.

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

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 charges.

Ortega-Hernandez was believed to be connected to last Friday's shooting after items found in an abandoned vehicle near the scene allegedly linked him to the incident, said sergeant David Schlosser, US park police spokesman.

The secret service said it discovered the bullet holes on Tuesday and that the bullet that hit the window was stopped by ballistic glass.

The location of the second bullet was not disclosed by the secret service, that stated only that the bullet "was found on the exterior of the White House".

Shots fired

Secret service agents heard shots fired on the street, south of the president's residence, on Friday.

Previously, authorities had said the White House did not appear to have been targeted.

Two cars were seen racing away from that scene. One of those vehicles was later found abandoned nearby with a
semi-automatic rifle on board.

Police also found an abandoned car Friday night near the Theodore Roosevelt Bridge that crosses the Potomac River to Virginia.

Ortega-Hernandezhad been reported missing on October 31 by his family.

He was stopped on Friday by police in Arlington, Virginia, after a citizen called in a report of somebody "circling the area", said Lieutenant Joe Kantor of the Arlington police department.

Source: Agencies