A Connecticut man who allegedly scaled a White House fence on Thanksgiving while wearing an American flag appeared in court Friday and was ordered to undergo a psychiatric evaluation.

Joseph Caputo, 23, of Stamford, Conn, is charged with illegally entering restricted grounds for allegedly jumping over the newly upgraded fence, triggering an hours-long White House lockdown.

After he was apprehended, Caputo allegedly told an officer "I love my country" and "I knew I would be locked up," according to court documents.

Caputo also left a "suicide note" that indicated he planned to die on Thursday, and he left an audio message with his mother telling her she may not be able to see him again, according to the documents.

Caputo was released to the custody of the Secret Service and will be evaluated before his next court appearance on Monday, officials said.