A Connecticut man who police say draped himself in an American flag and scaled the White House fence on Thanksgiving Day left a suicide note with friends he had been staying with in Virginia, according to court documents unsealed Friday.

D.C. Superior Court Judge Errol R. Arthur ordered the suspect, Joseph Anthony Caputo, 23, to undergo an emergency psychiatric evaluation at St. Elizabeths Hospital. His case will be transferred to U.S. District Court on Monday, and it will be handled by federal authorities.

Caputo, who lives in Stamford, Conn., is charged with making an illegal entry to restricted grounds, which carries a maximum penalty of one year in prison. Charging documents filed by the Secret Service say that Caputo intended to die on Thanksgiving Day, though pictures and video show that once he got onto the White House lawn, he immediately laid face down and surrendered.

Authorities said the breach occurred about 2:45 p.m. as members of President Obama’s family were celebrating Thanksgiving at the White House. The Secret Service has not said how Caputo managed to make it past new “pencil-point” spikes added to the White House perimeter this year to deter intruders. A Secret Service spokeswoman did not return calls Friday to answer questions about the fence.

The enhancements were put in place after Omar Jose Gonzalez, in September 2014, was able to make it over a fence to the president’s front door and into the first floor of the White House while carrying a folding knife. Authorities said that he had 800 rounds of ammunition, two hatchets and a machete in his car, parked nearby.

In a statement, Del. Eleanor Holmes Norton (D-D.C.), said she will ask for a Secret Service briefing on the security breach and the timing for a “permanent fix to the White House fence.”

Norton said Thursday’s incident “shows that the current fence fix does not work” and added that a solution must include allowing the public to get as close as they can to the White House. She noted that after Thursday’s intrusion, the Secret Service kept visitors on the far side of Pennsylvania Avenue. She said that if the situation is not corrected, “the Secret Service will concede that they lack the professionalism to maintain the security of the White House without blocking the American people.”

Caputo’s attorney, Paul Signet, declined to comment after Friday’s brief court hearing. At one point, a U.S. Marshal pulled folded yellow papers from Caputo’s back left pocket and handed them to a man and a woman seated in the courtroom, who appeared to be Caputo’s family members. When Caputo looked back, the woman’s eyes welled with tears. The couple walked away from the courthouse hand-in-hand and declined to comment to reporters.

In court, Caputo wore the same outfit he had on when police said he leapt over the White House fence: a blue-and-white long-sleeved shirt, white pants and Stars and Stripes Converse Chuck Taylor sneakers. The court document said that when he was arrested, he was carrying the flag, a flash drive designed to mimic the shield carried by the comic book character Captain America, a pocket guide to the U.S. Constitution and weightlifting gloves. It appears that he was wearing the gloves as he scaled the fence.

According to the court documents, Caputo told the arresting uniformed Secret Service officer, Lt. Ken Matthews: “I love my country. I knew I would be locked up.”

But the friends Caputo had been visiting since Monday showed police a note “that clearly contemplated that Caputo planned to die” on Thursday. The court documents said it read in part: “Death is a natural part of life. Rejoice for those around us who transform in the Force.” Police also said that he left a will at his mother’s Connecticut home and made an audio message warning her “that something will happen” and that he “may or may not be able to see her again.”

Before he went over the fence, Virginia resident Vanessa Peña, who was visiting the White House, saw a man behind her take off his sweatshirt and wrap an American flag around himself. Peña then heard him take a deep breath before saying, “ ‘All right, let’s do this.’ ”

“Then he just ran through us, jumped over the first barricade and went over the fence,” said Peña, who captured photos of the incident. “Right when he landed, he threw his arms in the air and went to his knees.” Police pushed through tourists to get them back through Lafayette Square, then closed off several streets.

Alice Crites, Carol D. Leonnig and Fenit Nirappil contributed to this report.