WASHINGTON (AFP): The man accused of attempting to assassinate US President Barack Obama when he fired shots at the White House in 2011 accepted a plea deal Wednesday that will get him at least 10 years in jail.

Oscar Ramiro Ortega-Hernandez, 22, pleaded guilty in federal court in Washington to one count of injury to a dwelling and placing lives in jeopardy, as well as one count of discharging a firearm during a violent crime, the Justice Department said in a statement.

Ortega-Hernandez also “admitted the attack was a terrorist attack,” the statement said, explaining this admission could result in an increased jail term.

Under the terms of the plea, 17 other charges, including that he did “knowingly attempt to kill the president of the United States,” have been dropped.

“Firing an assault rifle at the White House to make a political statement is terrorism, plain and simple,” said US Attorney Ronald Machen.

“As we have seen this week, gunmen who come to the nation’s capital bent on violence can inflict terrible damage,” he added, referring to Monday’s massacre at a navy base in the US capital, in which a gunman killed 12 before he died in a shootout with police.

On November 11, 2011, prosecutors said, Ortega-Hernandez opened fire at the residential area of the White House. He fired at least eight rounds from an assault rifle, at least one of which struck the mansion.

Neither Obama nor members of the first family were home at the time of the shooting, but a bullet was found days later embedded in the bullet-proof window of the second-floor, where the president and his family have their living quarters.

According to witnesses, Ortega-Hernandez called himself a modern-day Jesus, considered Obama to be a devil and was convinced that the government was conspiring against him.

He was arrested November 16, 2011, in Indiana, Pennsylvania, some 300 miles (480 kilometers) from the US capital.

A sentencing hearing has been set for January 10, 2014. He faces a minimum of 10 years and up to 27 and a half years in jail.