The ex-US Navy reservist who killed 12 people and wounded eight at a Washington DC Navy installation had received treatment for mental health issues, US media have reported.
Aaron Alexis, 34, was treated for paranoia, trouble sleeping and hearing voices, the Associated Press reported.
Before Monday's shooting at the Washington Navy Yard he was employed as a technical contractor there, reports the BBC.
He was shot and killed by police during the attack.
On Tuesday, the US capital remained in a state of shock after the shootings. The flag flew at half-mast over the White House, where hours after the shooting President Barack Obama had mourned "yet another mass shooting".
No motive is known for the attack.
The victims ranged in age from 46 to 73, and details about their identities and lives have just begun to emerge.
The shooting began about 8:20 local time (12:20 GMT) on Monday, when a gunman apparently shot his way into the heavily guarded Building 197, headquarters for Naval Sea Systems Command, which builds and maintains ships and submarines for the Navy.
As an employee of an IT contractor, Alexis apparently had a card granting him access to the building, authorities said.
Witnesses said the suspect sprayed bullets in a hallway and fired from a balcony down on to workers in an atrium at the heavily secured installation in the US capital.
He was reportedly armed with an AR-15 semi-automatic rifle, a shotgun and a handgun that he took from a police officer at the scene.
Police initially responded to reports of two other armed suspects, but after exhaustive searches authorities said they were all but certain that Alexis was the only gunman.
Anthony Little says his brother-in-law Aaron Alexis had "shown no sign" that he could carry out a shooting
Washington Police Chief Cathy Lanier told reporters the gunman "was engaged in shooting with police officers" when he died. "There is no question he would have kept shooting," she added.
Alexis was formerly a petty officer 3rd class who served full-time in the naval reserve from 2007-11, said the US Navy.
He received two routine medals for his service in the Navy: the National Defence Service Medal and the Global War on Terrorism Service Medal.
It was not immediately clear why he left the military, but unnamed military officers told US media there had been a series of misconduct issues during his service.
According to media reports, Alexis was a Buddhist convert who had had two previous gun-related brushes with the law.
In 2004 he was arrested in Seattle for shooting a construction worker's car tyres, in what he described as an enraged "black-out".
And he was questioned by Fort Worth police in 2010 after firing his gun through the floor of an upstairs apartment. He said it was an accidental discharge.
In addition to those killed in Monday's rampage, one police officer was shot in the legs, a female civilian was shot in the head and hand, and another woman was treated for a shoulder wound.
All three were expected to recover.