A man who wielded a gun near the White House on Friday was subdued by a U.S. Secret Service agent while President Barack Obama was golfing, officials confirmed.

The shooting happened off 17th and E streets near the South Lawn where the president’s home and offices are located nearby.

An unidentified man moved towards a checkpoint after 3 p.m. while carrying a gun. Secret Service officers cornered him and demanded him to drop the weapon, the Secret Service said in a statement, according to Reuters.

A Secret Service agent then shot the man once and was immediately taken into custody. He was then brought to the hospital under critical condition, the District of Columbia Fire and Emergency Medical Services Department said.

The man was identified as 30-year-old Jesse Oliveri, who said he wanted to die, as he walked towards the checkpoint where he was stopped by Secret Service agents.

Oliveri lives with his parents and is originally from Ashland, Pennsylvania.

A white car was seen parked on Constitution Avenue, which a few hundred yards from where Oliveri was shot. Federal officers discovered bullets for a .22 caliber weapon in the car’s front row seat.

Chaos ensued at the presidential compound as the Secret Service put the White House on lockdown temporarily as a safety measure.

President Obama was not at the White House during the shooting, as he went out with three of his aided for a game of golf. He left the premises at 1 p.m. and arrived at the Andrews Air Force Base 30 minutes later.

However, Vice President Joe Biden, who was at the White House at the time, was protected within the White House complex.

A spokesperson for the White House confirmed that no one working within the White House was injured and that the president has been “made aware” about the shooting, according to the Daily Mail.

This isn’t the first attack made in the nation’s capital for this year, as two similar incidents took place about two months ago.

An officer was forced to shoot a gunman during a daily screening at the U.S. Capitol Visitor Center. Officers were unable to properly identify the gunman at the time.