Former reservist, who killed 12 people, had been arrested in 2004 and 2010 and was discharged from the navy over one incident

Authorities are investigating why a former US navy reservist walked on to a historic naval base in Washington DC, opened fire and killed 12 employees before police shot him dead.

Aaron Alexis, 34, started shooting at the Washington navy yard just after 8am on Monday as many employees were arriving for work on the base.

It was later revealed later that he had been discharged from the US navy in 2011 after being arrested for a shooting incident while he was stationed at Fort Worth, Texas. It was at least the second time Alexis had been arrested for a gun-related incident.

The computer firm Hewlett-Packard confirmed he was employed by one of its subcontractors on an IT project. At a late-night press conference, the FBI said Alexis had gained access to the base with his contractor's ID.

As authorities began to piece together the details of what happened, Barack Obama lamented "yet another mass shooting" and called it a "cowardly act".

Police released an initial list of seven people killed. They were Michael Arnold, 59; Sylvia Frasier, 53; Kathy Gaarde, 62; John Roger Johnson, 73; Frank Kohler, 50; Kenneth Bernard Proctor, 46; and Vishnu Pandit, 61. Other victims' names were being withheld until family were notified, officials said. All were civilian staff.

Emergency vehicles gather at the scene. Photograph: Alex Wong/Getty Images

Doctors at the MedStar Washington hospital centre said they were treating three victims. The chief medical officer, Janis Orlowski, said one police officer had multiple gunshot wounds to his legs and was undergoing complex surgery. It was unclear whether he would walk again, she said. Two other civilian patients were women: one shot in her shoulder, the other in her head and hand. The second woman's head wound was not serious: "She is a very, very, lucky young lady," Orlowski said.

There was no indication of a motive. Addressing questions about whether it had been a terrorist attack, the mayor of Washington, Vincent Gray said: "We don't have any reason to think that at this stage."

On Monday night, officers from the New York police department cordoned off a section of the tree-lined street in Brooklyn, where relatives of Alexis lived in a brownstone apartment.

The navy yards incident began at about 8.15am, in building 197 of the complex, when many people were having breakfast in the basement cafeteria. The building houses the naval sea systems command headquarters, which employs 3,000 people.

A witness, Rick Mason, said a gunman was shooting from a fourth-floor overlook in the hallway outside his office. He said the gunman was aiming down at people in the cafeteria. Mason said he could hear the shots but could not see a gunman. He said there were multiple levels of security to reach his office. That "makes me think it might have been someone who works here", he told the Associated Press.

Staff are led to safety from the Washington naval yard. Photograph: Jonathan Ernst/Reuters

A lockdown remained in effect for hours after the shooting. Sailors and civilians assigned to the Washington navy yard, as well as all personnel assigned to the nearby joint base Anacostia-Bolling, were advised to stay put while authorities continued to investigate the scene.

In the confusion after the attack, police initially feared two other men dressed in "military-style" uniform had been involved, and launched a huge manhunt. They issued descriptions of two suspects, one said to have been a white man wearing a navy-style khaki uniform and carrying a pistol, the second described as black and wearing a drab olive military uniform and carrying a rifle.

One of the suspects was quickly identified and ruled out of the investigation. The second was not eliminated from inquiries until later in the evening. At a 10pm press conference, police said the manhunt was over and lifted remaining restrictions on residents.

Police in Seattle said Alexis was arrested in 2004 after an incident that he described to detectives as an anger-fuelled "blackout". Two workers on a construction site told police that Alexis walked out of a next-door home on 6 May 2004, pulled a pistol from his waistband and fired three shots into the rear tyres of their parked car. Alexis later told police he thought the victims had "disrespected him".

Court records reviewed by the Associated Press said he was released on the condition that he did not contact any of the workers.

Police walk on the roof of a building as they respond to the shooting. Photograph: Joshua Roberts/Reuters

According to a statement by Seattle police, Alexis's father told detectives his son had "anger management problems" associated with post-traumatic stress disorder. He had been an "active participant in rescue attempts on 11 September 2001", the Seattle police statement said.

Alexis signed up for the reserves in 2007. In 2010, while he was based at Fort Worth in Texas, he was arrested after discharging a firearm into the ceiling of his upstairs neighbour. Police accepted his explanation that it was an accident, but it appears that the incident led to Alexis's discharge from the navy in 2011.

After leaving the reserves, Alexis worked as a waiter and delivery driver at the Happy Bowl Thai restaurant in White Settlement, a suburb of Fort Worth, according to Afton Bradley, a former co-worker, quoted by the Associated Press.

A former acquaintance, Oui Suthametewakul, said Alexis lived with him and his wife from August 2012 to May 2013 in Fort Worth, but that they had to part ways because he was not paying his bills. Alexis was a "nice guy", Suthametewakul said, though he sometimes carried a gun and would frequently complain about being the victim of discrimination.

Suthametewakul said Alexis had converted to Buddhism and prayed at a local Buddhist temple. Ty Thairintr, who attended Wat Budsaya, a temple in Fort Worth, said: "We are all shocked. We are nonviolent. Aaron was a very good practitioner of Buddhism. He could chant better than even some of the Thai congregants."

Thairintr said that Alexis told him and others at the temple that he had taken a job as a contractor and he indicated to them he was going to go to Virginia. He last saw Alexis five weeks ago. "He was a very devoted Buddhist. There was no tell-tale sign of this behaviour," Thairintr said.

Police respond to the report of a shooting at the naval yard. Photograph: Saul Loeb/AFP/Getty Images

Hewlett-Packard said Alexis was employed as a subcontractor for The Experts, a professional services company based in Alexandria, Virginia. It said in a statement: "Aaron Alexis was an employee of a company called The Experts, a subcontractor to an HP Enterprise Services contract to refresh equipment used on the navy marine corps intranet (NMCI) network. HP is co-operating fully with law enforcement as requested."

On its website, The Experts describes itself as providing "innovative and mission-critical IT, engineering and litigation professional services for federal, state and local governments and departments".

It said in a statement: "The Experts would like to express our deepest condolences and sympathies regarding the incident that occurred at the DC naval yards. We are actively co-operating with the FBI and other authorities in relation to the investigation on the suspect."