WASHINGTON (Reuters) - The attack on Donald Trump raised questions about how the Republican presidential candidate is protected on the campaign trail and what caused the apparent security lapses at Saturday's rally.

While information about the incident is still sparse, at least one person interviewed by the BBC said he had tried to alert police and the U.S. Secret Service, to no avail, to an apparent sniper climbing onto a nearby roof outside the security perimeter of the rally venue in Butler, Pennsylvania.

As a former president and the Republican presidential candidate, Trump is protected primarily by the Secret Service.

During most of Trump's campaign stops, local police aid the Secret Service in securing the venue. Agents from other agencies within the Department of Homeland Security, such as the Transportation Security Administration, occasionally help.

It is no easy task. Many Trump rallies feature thousands of audience members, take place in the open air and last for hours.

Before the event, agents scan the venue for bombs or other threats, and Trump invariably arrives in a fortified motorcade.

Law enforcement officials typically put up barriers as a perimeter, and require all attendees to go through a metal detector to enter the venue. Armed protective agents search all attendees' bags and even wallets. Many rallygoers are patted down by hand.

Saturday's attack, however, appeared to have been committed by a gunman located outside the secured perimeter, according to initial media reports.

A local resident who was present at the Saturday event and asked to remain anonymous, said he saw what appeared to be two Secret Service agents perched on a nearby roof ahead of the event. He said the agents had been scanning the area with binoculars beforehand.

"They kept looking over to the left behind the event, before Trump came on stage. They seemed very focused on that area," said the attendee.

The Secret Service said shortly after the shooting that it has begun an investigation and briefed Democratic President Joe Biden, though the agency did not immediately respond to additional requests for comment regarding its protocols.

The Pennsylvania State Police referred questions to the Secret Service, which did not immediately respond.

In the moments after Trump was injured, the former president was quickly surrounded by Secret Service personnel who formed a human shield, while heavily armed agents in body armor and toting rifles also took to the stage and appeared to scan the area for threats.

Trump was whisked by the agents to a black SUV, and taken to a local hospital, according to the campaign.

(Reporting by Gram Slattery in Washington and Alexandra Ulmer in San Francisco; Editing by Ross Colvin and Daniel Wallis)

By Gram Slattery and Alexandra Ulmer