(CNN) -- An Idaho man who admitted trying to assassinate President Barack Obama by shooting at the White House received a 25-year prison sentence on Monday.
Oscar Ortega-Hernandez, 23, appeared in federal court after pleading guilty in September to terrorism and weapons charges. He had been originally indicted on 17 criminal counts.
Prosecutors had charged Ortega-Hernandez with firing a Romanian-made assault rifle out of the window of his car the evening of November 11, 2011.
After sending a number of rounds toward the White House, he sped away toward a bridge leading to the Virginia suburbs, but crashed his vehicle and fled on foot, officials said.
The government said Ortega-Hernandez's fingerprints were found on ammunition magazines left in a 1998 Honda, but not on the weapon itself, which also was left in the car.
Neither the President nor his family were at home at the time of the incident.
"This man drove cross-country to launch an assault rifle attack on the White House from Constitution Avenue," said U.S. Attorney Ronald Machen, whose office prosecuted the case. "He was motivated by hatred for the President and the desire to start a revolution against the federal government.
"We are very fortunate that his bullets narrowly missed the U.S. Secret Service officers guarding the White House that night. This 25-year prison sentence demonstrates that anyone who comes to the nation's capital planning to use violence should expect to spend decades behind bars."
Ortega-Hernandez was captured at a Pennsylvania motel five days after the incident.
In court documents, prosecutors argued Ortega-Hernandez was dangerous and planned out his alleged crime over a period of months.
According to the FBI, Ortega-Hernandez's friends reported that he made anti-government statements beginning in 2010.
Officials said he believed the federal government was trying to control Americans through GPS, fluoride and aspartame.
He was also angry at what he believed was U.S. bullying of other countries, including in the wars in Afghanistan and Iraq, and claimed that the President was the "anti-Christ" and told friends he was "on a mission from God to take out Obama."