WASHINGTON — A knife-carrying Army veteran who scaled a White House fence and dashed into the executive mansion before being caught took a plea deal Friday.

Omar Gonzalez, 43, pleaded guilty to two federal charges. Federal sentencing guidelines recommend between 12 and 18 months in prison.

The Sept. 19 incident in which Gonzalez made it into the mansion’s East Room preceded the disclosure of other serious Secret Service breaches in security for President Barack Obama and ultimately led to Julia Pierson’s resignation as director of the agency.

President Barack Obama, the first lady and their daughters were not home when Gonzalez got inside the mansion.

Following Gonzalez’s arrest, investigators found hundreds of rounds of ammunition, a machete and two hatchets in his car. A folding knife he was carrying in his pants pocket when he was arrested had a blade that was over 3½ inches long.

Gonzalez told a Secret Service agent following his arrest that he “was concerned the atmosphere was collapsing and needed to get the information to the president ..” court documents say.