President Donald Trump was evacuated from a gala dinner on Saturday night after a gunman opened fire near a security checkpoint at the event in Washington DC.
The suspect, identified as 31-year-old Cole Tomas Allen, will appear in court on Monday.
He was tackled by agents just short of a staircase which leads down to a ballroom where the annual White House correspondents' dinner attended by hundreds of journalists and public figures was getting under way.
Officials said he possessed multiple weapons and appears to have acted alone. In an exchange of fire, a federal agent was hit but saved by his bullet-proof vest.
Key Developments
Acting US Attorney General Todd Blanche said the suspect was targeting administration officials including, most likely, the president. Several members of Trump's Cabinet including his vice-president were there.
"It's a dangerous profession," said Trump after the attack.
CCTV footage posted by Trump from the Washington Hilton hotel, where the dinner was taking place, shows a person rushing past security officers, who then turn and chase him.
Seconds later security officials and the suspect exchanged fire, with between five and eight shots fired.
Inside the ballroom on the floor below, footage showed Trump and the first lady at their seats on a stage at the front of the room when loud bangs were heard in the distance.
Security agents flanked the president and first lady to rush them off the stage towards an exit. As they were leaving, a video shows Trump appearing to fall down to the floor.
In an interview with the 60 Minutes programme, Trump said that he heard the instruction "please go down on the floor", adding that the Security Service "pretty much" wanted him to crawl out of the room.
Guests were seen ducking under their tables and shielding themselves behind chairs as several Secret Service agents held their weapons on stage.
Several BBC correspondents were in attendance at the dinner, and described scenes of widespread confusion following the sound of gunshots.
The room was briefly locked down, before an announcement that the event would be delayed and rescheduled.
Trump later posted a close-up photo of a shirtless man on the floor with his hands cuffed behind his back, with Secret Service personnel standing around him.
The White House correspondents' dinner is an American press tradition that dates back to 1921, and is historically attended by the sitting president. Trump was last in attendance in 2011, and this was the first time he had attended as president.
The suspect has been identified as Cole Tomas Allen of Torrance, California, according to law enforcement sources quoted by US media.
On the night of the dinner, the 31-year-old was a guest at the hotel hosting the event and was found with a shotgun, a handgun and knives after his arrest, police said.
Within hours, FBI agents and police were seen searching an area at a California address believed to be linked to the suspect.
Investigators are also reviewing writings from the suspect, which state he wanted to specifically target administration officials, a senior US official told CBS News.
One of Allen's family members alerted police after receiving writings from him before the attack. The writings sent to family members reportedly did not specifically mention the White House Correspondents' Association Dinner.
It allegedly says the gunman wanted to target members of the Trump administration "from highest-ranking to lowest" and that while guests and hotel staff were not the intended targets, they would be attacked if necessary to get to the officials.
BBC News has not independently verified the alleged writings, which have been described as a manifesto and were reportedly sent to the suspect's family members before the attempted attack.
Trump mentioned the manifesto in media interviews. He told CBS's 60 Minutes programme that the suspect "was a Christian - believer, and then he became an anti-Christian, and he had a lotta change".
Allen describes himself as a mechanical engineer, game developer and teacher on LinkedIn.
According to his profile, he studied mechanical engineering at the California Institute of Technology (Caltech), before graduating with a master's in computer science from California State University in 2025.
Caltech confirmed to CBS in an email that Allen had graduated from the institute in 2017, but provided no further details.
A computer science professor who taught Allen at California State University described him as "soft-spoken, very polite, a good fellow".
"I am very shocked to see the news," he told the Associated Press news agency.
Jeanine Pirro, US attorney for Washington, said he was facing two charges - using a firearm during a crime of violence and assault on a federal officer using a dangerous weapon.
He will be formally charged on Monday in federal court.
Acting US Attorney General Blanche told CNN it "remains to be seen" whether more charges will be raised against the suspect, adding he could "absolutely" be charged with attempted assassination depending on the evidence.
President Trump said the US had cancelled plans to send a team to Pakistan for negotiations.
Oz Pearlman - a self-described "mentalist" - was speaking to Trump, First Lady Melania Trump and press secretary Karoline Leavitt as the attack happened.
The suspect's writings said he wanted to target Trump administration officials, acting US Attorney General Todd Blanche said.
The British monarch returns to the US on Monday, a country he has been visiting for decades.
King Charles and Queen Camilla will visit Washington DC, New York and Virginia during their four-day trip.