By Frank Gardner, security correspondent, and James FitzGerald, BBC News
The US Secret Service has one job – to protect current and former US presidents – and in that they failed spectacularly when an attempt was made on Donald Trump’s life on Saturday.
It has been 43 years since the last assassination attempt on a former or present US president, when Ronald Reagan was shot in the lung but survived.
Today, American politicians and the public want to know how a would-be assassin was able to crawl onto a rooftop vantage point, armed with a rifle, and let off four shots towards the podium – all in an area that was supposed to have been cleared.
Why were warnings from the public apparently ignored or not acted upon?
And why, when a highly charged presidential election is just four months away, did the Secret Service not do a better job of protecting the man many believe will be America’s next president?
The investigation that is already under way involves the FBI as well as the Secret Service and the Department of Homeland Security.
The Secret Service director, Kimberly Cheatle, has been summoned to testify before a committee of the US House of Representatives on 22 July.
Witness says warnings were ignored
Those who attended the rally itself were asked to pass through metal detectors to ensure they were not bringing any weapons, the Philadelphia Inquirer reported.
But the gunman believed to have fired the shots could clearly be seen crawling around with a rifle on top of a nearby building for several minutes, one eyewitness told the BBC.
The witness, who called himself Greg, said warnings that he and others gave were not acted upon by police, who he suggested did not know “what was going on” and had poor visibility of the rooftop.
The suspected gunman – who has been named by the FBI as 20-year-old Thomas Matthew Crooks – also appears to have been caught on camera lining up his shot, in footage obtained by TMZ.
One spectator was killed and two others critically injured before the gunman was himself shot dead. Trump was also injured in the ear. State police have said it is “too early” to determine exactly what happened.
Trump’s life might have been saved by the fact he ducked after the first shots were fired, said David Dunn, a professor of international politics from the University of Birmingham.
In that respect, he “clearly had been well trained by the Secret Service”, Prof Dunn told BBC Radio 5 Live. Before being whisked away in a car by agents, Trump rose again to pump his fist before the crowd.
Greg said he was left wondering why agents were not deployed on all the nearby rooftops, and did not intervene to take Trump off stage after he raised the alarm.
Former Secret Service agent Charles Marino agreed that there were questions to answer. He told the BBC it would have been among the agents’ tasks to survey the surroundings and note “concerning areas”.
Experts who spoke to NBC said events such as political rallies always brought challenges in securing a wide expanse of land. One of them, former Secret Service agent Evy Poumpouras, said there would always be lingering questions: “How do you secure that outer perimeter? How far do you go? And can you cover everything? That’s a problem.”
Analysis from BBC Verify suggests that Crooks was able to get a little more than 130m (430ft) from Trump’s position behind the lectern.
It was announced late on Saturday that the FBI had assumed the role of lead investigator into the incident, which it describes as an assassination attempt.
One of its special agents said at a news conference it was “surprising” that the gunman had been able to open fire before the Secret Service killed him.
But when asked if there was a failure of security, he said his team was “not gonna make that assessment” while the investigation continued.
The Secret Service was not represented at the briefing. An earlier statement confirming the start of the investigation promised more information would be released when available.
Meanwhile, the Department of Homeland Security said maintaining the security of presidential candidates was one of the departments “most vital priorities”.
It is not clear what the attack will mean for the former president’s future security arrangements, though an adviser to the Trump campaign said it was clear he needed more protection.
A Secret Service spokesman has denied an “untrue assertion” that it was asked by Trump’s team for extra resources, but rebuffed this request.
In any case, Trump was now likely to receive a security detail comparable to that of a sitting president, former Secret Service agent Joseph LaSorsa told the Reuters news agency.
“There will be an intensive review… there’s going to be a massive realignment,” he said. “This cannot happen.”
The Republican National Convention will go ahead as planned on Monday, with a speech from Trump on Thursday, as confirmed by a statement from the party.
During the event, Trump will be officially nominated as the Republican candidate for president ahead of November’s election.