Secret Service agents have shot dead a gunman outside the White House while US President Donald Trump was inside.

CNN reporters heard what appeared to be dozens of gunshots near the White House, triggering a lockdown and a rapid response from the US Secret Service.

The Secret Service said that President Trump — who was at the White House at the time — was not "impacted.”