Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A man was shot by a Secret Service agent outside the White House grounds after approaching a checkpoint with a gun and refusing commands to drop it, officials said.

The man approached a checkpoint on E Street with a gun at around 3:06 p.m. and was shot in the chest, the Secret Service said. Law enforcement officials identified the man who was shot as Jesse Olivieri from Ashland, Pennsylvania.

The shooting prompted a lockdown at the White House and sent heavily-armed Secret Service personnel fanning out across the complex and a sniper scanning the area from the top of the building.

"He was carrying a gun — a silver gun in clear sight — walked through the fence line,” said Larry Samples, who was on E and witnessed the shooting near 17th and E streets, southwest of the White House.

"They immediately tried to stop him and came up to him," Samples said. "[Authorities] yelled multiple times 'stop, stop, stop.' He kept ignoring them."

Several law enforcement officials said they believe it may have been an attempt at suicide by cop, and that Olivieri said he wanted to die. "There is no known nexus to terrorism," police and the Secret Service said in a statement.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

A Secret Service agent orders people into buildings near the entrance to the West Wing of the White House in Washington, Friday, May 20, 2016, after the White House was placed on security alert after shooting on street outside. Andrew Harnik / AP

D.C. Fire and EMS said Olivieri was transported to a hospital in critical condition. Rohail Khan, who said he was around 5 feet from the shooting, said he heard a single shot and then Secret Service yelled for everyone to get down.

Olivieri was allegedly brandishing the gun and was shot after refusing several commands to drop it, authorities said. Samples described him as around 5 feet, 10 inches tall with shaggy blonde hair. A weapon was recovered, officials said.

"I saw the Secret Service and officers coming around him," Samples said. "They surrounded him. They gave him multiple chances to stop his advance and he refused. He just kept walking. He had a gun in plain sight."

President Barack Obama was not at the White House. He was out for an afternoon of golfing, officials said.

Government sources said two Secret Service officers had eyes on Olivieri before he even pulled out the gun and had "shadowed" him. He was never inside the White House complex.

Taylor Cates was outside of the White House with her boyfriend when she spotted a man with a gun.

"He had a a gun out, just in plain sight. I mean, it wasn't even hidden," Cates said. "He looked at me, then kept walking," she said.

Cates and her boyfriend and three other people nearby stopped, unsure what to do and afraid of getting any closer. She said the man weaved through a crowd and approached the security gate.

"He had no facial expression at all," Cates said. "It was honestly terrifying," she said.

Washington, D.C., Metropolitan police will investigate the shooting, and the FBI will look into Olivieri’s background, according to law enforcement officials. Olivieri will likely be charged with assaulting a federal officer, officials said.

Park Police and Secret Service officers searched Olivieri’s car, parked a few blocks away. He was taken to George Washington University Hospital. The White House lockdown was lifted by 4 p.m.

The Secret Service announced last year that it would be adding "temporary security enhancements" to the White House, including an anti-climb feature with sharp metal spikes on top of the fence surrounding the grounds, after a series of high-profile incidents.

In September of 2014, a man scaled the White House fence and made it all the way into the East Room before he was tackled and arrested. Omar Gonzalez, 43, pleaded guilty to charges related to the breach and was sentenced to nearly 1 1/2 years in prison. Prosecutors said he has a history with law enforcement where he described having "paranoid delusions."