Assistant US Attorney David Mudd said Monday that Gonzalez, who was carrying a knife, had been arrested in mid-July in southwestern Virginia for having a sawed-off shotgun and a map of the White House.
In August, he was questioned near the presidential residence while in possession of a hatchet, but security officers let him go after searching his car and determining that he was carrying only camping gear.
The revelations were made public at the 42-year-old Gonzalez's appearance before Federal Judge John M. Facciola in Washington.
After the short court session, Facciola ordered the Iraq war veteran, originally from Texas, to remain under arrest given that his "preoccupation with the White House and his acquisition of a vast amount" of ammunition made him a danger to the president and the community, as Mudd had argued.
The court document signed by Secret Service agent David Hochman, to which the daily Washington Post gained access, says that after being arrested on the White House grounds, Gonzalez told the Secret Service that he was concerned because the "atmosphere was collapsing" and he felt he needed to inform the president.
Gonzalez's family has said that he is suffering from post-traumatic stress disorder.
His next court appearance is scheduled for Oct 1.
The Secret Service ordered stronger White House security after Gonzalez climbed over the fence, ran across the lawn and entered the North Portico door of the executive mansion before being caught.
Once in a while agents have had to detain people who scale the fence around the White House, but for an intruder to get inside the building is virtually unknown and the incident shocked Washington.
In his daily press conference, White House spokesman Josh Earnest said Monday that Secret Service Director Julia Pierson has launched a comprehensive review of what happened last Friday.
The spokesman said he discussed the incident with President Barack Obama, who at the time of the incursion was not at the White House, having gone with his family to Camp David for the weekend.
Earnest noted that "the Secret Service has the challenging task of balancing the need to ensure the safety and security of the first family, while also ensuring that the White House continues to be the people's house".
Several media outlets, including the Washington Post, have criticised the performance of the Secret Service, the credibility of which was previously tainted by several scandals involving the inappropriate conduct of agents during presidential visits abroad.