NEW YORK — An armed veteran slipped through a side door of a federal building on Friday and shot a security guard in the head, killing him, before fatally shooting himself, police said.

Detectives were investigating what prompted the shooting of FJC Security Services guard Idrissa Camara, who was supposed to have gotten off work at 4 p.m. but agreed to stay on for an extra shift.

The shooter, Kevin Downing, entered through a side entrance of the Manhattan building, which houses an immigration court, a passport processing center and a regional office for the Department of Labor, police said.

Downing was a former federal employee at the Bureau of Labor Statistics, police Deputy Commissioner for Intelligence and Counterterrorism John Miller said. But it was unclear if Downing, of Fort Lee, New Jersey, had worked at the building where the shooting occurred, about a mile and a half from the World Trade Center.

Downing had collected Veterans Affairs benefits, but police were still determining which branch of the armed service he served.

He shot Camara, 53, at close range, then walked through a screening area and headed toward an elevator, where he encountered another employee, and then he shot himself in the head, said James O'Neill, a chief with the New York Police Department. He was pronounced dead at the scene.

Federal agents were at Downing's suburban home, awaiting a court order to begin searching it for anything that could provide investigators with insight about what prompted the shooting, Miller said.

"We don't know what his target was," O'Neill said. It appears the gunman acted alone, and O'Neill said there was no indication the shooting was terrorism.

Miller said Downing had left his government job "some time ago." A spokesman for the U.S. Department of Labor, which controls the Bureau of Labor Statistics, did not immediately respond to a message seeking comment. The FBI was assisting in the investigation because Camara was working as a contractor for a federal agency, police said.

Camara, a senior guard, was armed but never had a chance to defend himself, according to the security company.

"Camara ... was an extraordinary Senior Guard who was well trained, cared deeply about his job and knew that building better than anyone else," said Michael McKeon, a spokesman for the security company. "Our thoughts and prayers are with his wife and family. We intend to do everything we can to stand with them during this very difficult time."

Hector Figueroa, the president of Camara's union, 32 BJ SEIU, said he was horrified by the news.

"Security officers around the city and country serve on the front line each and every day to keep us safe and secure," Figueroa said. "We are heartbroken that one of our own has fallen."

Employees at the building said they were told to get down on the ground when the shots rang out. A short time later, the building was placed on lockdown and then was evacuated.

Associated Press writers Michael Balsamo, Jennifer Peltz and David B. Caruso contributed to this report.