A US Secret Service agent has shot a gunman near the White House while President Barack Obama was out golfing.
The Secret Service, which protects the president and his family, briefly locked down the White House as a precaution.
Vice-President Joe Biden was secured within the White House complex during the lockdown, a White House spokeswoman said.
The shooting on Friday (Saturday AEST) just off 17th and E Streets happened near what is known as the South Lawn outside the home and offices of the president.
When a man carrying a gun had approached a checkpoint uniformed officers ordered him to stop and drop the weapon, the Secret Service said.
"When the subject failed to comply with the verbal commands, he was shot once by a Secret Service agent and taken into custody," it said.
The District of Columbia Fire and Emergency Medical Services Department said the man was taken to hospital in a critical condition.
Brett Polivka, a 26-year-old visitor from Texas who was near the south side of the White House, said a man who appeared to be in his mid-20s had walked to a gate of the White House holding a silver-coloured gun pointed at the ground.
"A couple officers drew their guns, went right at him and within two or three seconds we heard a gunshot," Polivka said.
The Secret Service, which also guards other top dignitaries, said all those under its protection were safe.
The shooting followed several incidents that raised questions about the Secret Service's performance.
In September 2014 a knife-carrying man jumped a fence and ran into the White House in one of the worst security breaches during Obama's tenure.
That episode led to the resignation of the Secret Service's director.
In March 2015 two Secret Service agents capped off a night of drinking by driving into a White House barricade centimetres away from a suspicious package investigators were examining.
In 2011 a man hit the White House with automatic rifle fire, though damage to the building was not discovered for several days.