The US department of homeland security’s inspector general is investigating the Secret Service’s handling of security for former president Donald Trump on the day a gunman tried to assassinate him at a Pennsylvania rally.

The agency said on its website that the objective is to evaluate the service’s “process for securing former President Trump’s July 13 2024 campaign event”.

No date was given for when the investigation was launched.

Mr Trump was injured in the shooting (AP)

The shooting has raised questions about how the gunman was able to climb onto a roof with a clear line of site to the former US president, who was injured.

US President Joe Biden has already directed an independent review of the security at the rally.

Secret Service director Kim Cheatle said the agency understands the importance of the review ordered by Mr Biden and would fully participate in it as well as with congressional committees looking into the shooting.

The 20-year-old gunman, Thomas Matthew Crooks, was able to get within 135 metres (442ft) of the stage where the Republican former president was speaking when he opened fire.

That is despite a threat on Trump’s life from Iran leading to additional security for the former president in the days before the Saturday rally.

Mr Trump was left bloodied in the assassination attempt (AP)

A bloodied Mr Trump was quickly escorted off the stage by Secret Service agents, and agency snipers killed the shooter.

Mr Trump said the upper part of his right ear was pierced in the shooting. One rallygoer was killed, and two others were critically wounded.

Ms Cheatle said the agency was working to understand how Saturday’s shooting happened and to make sure something like it never does again.

The agency of roughly 7,800 staff members is responsible for protecting presidents, vice presidents, their families, former presidents, their spouses and their minor children under the age of 16 and a few other high-level cabinet officials such as the homeland security secretary.