Image copyright Reuters Image caption Omar Gonzalez will be barred from Washington DC during a supervised release after a prison term

An Iraq war veteran who jumped the White House fence and ran into the building with a knife has pleaded guilty to two charges.

Omar Gonzalez, 42, made it past the front door and all the way to the executive mansion's East Room before being tackled.

As part of a plea deal, he will serve between 12-18 months in prison and be barred from entering Washington DC.

He was previously ordered to undergo a 30-day mental health evaluation.

Gonzalez will be sentenced in June.

Image copyright Reuters Image caption Gonzalez made it across the White House's front lawn and dozens of metres into the mansion

The breach was led to the resignation of the director of the Secret Service, the agency responsible for protecting the president.

"We are pleased that Mr Gonzalez has chosen to take responsibility for his incomprehensible decision to leap a fence and charge into the White House with a knife," US Attorney Ronald Machen said in a statement.

"He is lucky to be alive," Mr Machen said, adding the US anticipates he will be required to undergo psychiatric treatment.

Gonzalez scaled the White House fence on 19 September, dashed across the lawn and gained entry through an unlocked door, then barrelled past a guard and ran into the East Room before being tackled.

Image copyright AP Image caption Gonzalez reportedly told officials he feared the atmosphere was collapsing and needed to warn the president

Eight hundreds rounds of ammunition, two hatchets and a machete were found in his car, officials say.

Gonzalez, an Iraq War veteran said to suffer from post-traumatic stress disorder, was previously stopped by Virginia police in July.

Officers found two powerful rifles, four handguns and other firearms and ammunition in his vehicle along with a map marking the White House.

In addition, it has been reported Secret Service agents interviewed Gonzalez twice during the summer but concluded he was not a security threat.