A gunman opened fire near the White House on Saturday evening before being killed in a shootout with United States Secret Service agents, during which a bystander was also wounded, authorities said.

President Donald Trump was in the White House at the time – on a day when he was working to negotiate a deal with Iran – but was not impacted by the incident, Secret Service communications chief Anthony Guglielmi said in a statement.

The confrontation took place just after 6 p.m. (10 p.m. GMT) when a man near the White House security perimeter "pulled a weapon from his bag and began firing."

"Secret Service Police returned fire, striking the suspect, who was transported to an area hospital where he was pronounced deceased. During the shooting, one bystander was also struck by gunfire," Guglielmi said, without giving details on the bystander's condition.

No Secret Service officers were hurt.