A Secret Service officer shot an armed man who approached the White House complex Friday afternoon with a weapon in plain sight and refused to drop it, law enforcement officials said – in an incident that put the White House temporarily on lockdown. 

The lockdown has since been lifted, and officials say everyone at the White House is "safe and accounted for." President Obama was out playing golf at the time of the incident -- but Vice President Biden was in the complex, and secured, his office said. 

While an official stressed the suspect did not access the White House complex itself, the shooting happened within view of sightseers outside the front of the building.

Late Friday, a U.S. law enforcement official told Associated Press that authorities had identified the gunman as Jesse Oliveri of Ashland, Pennsylvania. The official spoke on condition of anonymity because the official was not authorized to release the information.

The suspect is in custody and has since been transported to a hospital, but senior Capitol Hill sources say he was "critically wounded" and is not expected to survive. 

The motive appears to have been “suicide by cop,” a source told Fox News. 

Fox News is told the individual, carrying a pistol, already had come to the attention of the Secret Service and was being shadowed by two officers. 

According to a Secret Service statement, officers then gave "numerous verbal commands for the subject to stop and drop the firearm," but he "failed to comply." The Secret Service opened fire, shooting the suspect in the stomach. 

"The Secret Service recovered a firearm at the scene," the statement said. 

Federal agents found ammunition inside a Toyota sedan, parked nearby, that the gunman was believed to have driven, a U.S. law enforcement official told The Associated Press.

The Metropolitan Police Department, the Secret Service, Park Police and the FBI said in a joint statement that there was no known nexus to terrorism.

U.S. Park Police tweeted that the shooting took place on West Executive Drive a little after 3 p.m. ET. 

The incident prompted the Secret Service to clear the White House lawn and put the complex on lockdown.

The White House grounds were also shut down to pedestrian traffic, temporarily locking staff members and reporters indoors. 

Obama was not at the White House. He'd left two hours earlier for an afternoon round of golf.

"No one within or associated with the White House was injured, and everyone in the White House is safe and accounted for. The president has been made aware of the situation," the White House said in a statement. 

Fox News’ Matt Dean, James Rosen and Chad Pergram, Catherine Herridge and The Associated Press contributed to this report.