Media playback is unsupported on your device Media caption The BBC's North America editor Mark Mardell reports

The man who killed 12 people at a Washington DC Navy installation had received treatment for mental health issues, US media report.

Former US Navy reservist Aaron Alexis, 34, had been treated for paranoia, hearing voices and sleeplessness, the Associated Press reported.

The military contractor had a valid pass for Washington Navy Yard, where the attack unfolded, authorities said.

Alexis was shot and killed by police during Monday's assault.

On Wednesday, US Secretary of Defense Chuck Hagel acknowledged "there were a lot of red flags" in Alexis's background that had been missed in the security clearance process which ultimately resulted in his having access to the secure building where he undertook the attack.

"Why they didn't get picked up, why they didn't get incorporated into the clearance process, what he was doing, those are all legitimate questions that we're going to be dealing with," he told reporters.

He said he had ordered the Pentagon to conduct a wide-ranging review of the physical security at all US defence installations across the world and of the security clearance process.

"Where there are gaps, we will close them," he said. "Where there are inadequacies, we will address them. And where there are failures, we will correct them."

Alexis reportedly approached the US Department of Veterans Affairs in August to seek psychological help.

'Microwave delusion'

It has also emerged that last month he called police from a hotel in the US state of Rhode Island to say he kept hearing voices.

Will this tragedy make a difference to the debate on gun control? No

According to a Newport police report, he told officers he believed people were following him and "sending vibrations into his body".

Alexis said he had twice moved hotels to evade his pursuers, who he believed were using "some sort of microwave machine" to stop him from sleeping.

Secretary of the Navy Ray Mabus has ordered a physical security review of all Navy and Marine Corps installations, a Navy official told the BBC.

On Tuesday, the US capital remained in a state of shock and mourning.

Defence Secretary Hagel laid a wreath at US Navy Memorial Plaza in honour of the Navy Yard victims.

The attack took place on Monday morning at Building 197, headquarters for Naval Sea Systems Command, which builds and maintains ships and submarines for the Navy.

Aaron Alexis Born in New York City in 1979; last known address was Fort Worth, Texas

IT worker for a defence department subcontractor

Full-time US Navy reservist from 2007 till discharge in 2011, ranked petty officer 3rd class

Said to have been Buddhist convert, had gun-related brushes with law in 2004 and 2010 Profile: Aaron Alexis

Witnesses said the gunman 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.

The attack only ended when police stormed the building and shot him dead.

Alexis was armed with a shotgun legally purchased in Virginia, as well as a handgun authorities say he may have taken from a guard inside the naval complex.

Previous reports suggested he had used an AR-15 semiautomatic rifle. But officials said on Tuesday that although the weapon had been found at the scene, it was neither carried nor used by the gunman.

In addition to the 12 shot and killed, three people - a police officer and two female civilians - received gunshot wounds, but all were expected to survive. Five others were treated for minor injuries.

'Insubordination'

On Tuesday, authorities said they believed Alexis had acted alone and that all victims - ranging in age from 46 to 73 - had been identified.

Media playback is unsupported on your device Media caption Anthony Little on his brother-in-law Aaron Alexis

As an employee of an IT contractor, Alexis apparently had a card granting him access to the building - even though he had had several run-ins with the law and had been discharged from the Navy under a cloud, authorities said.

"It really is hard to believe that someone with a record as chequered as this man could conceivably get, you know, clearance... to be able to get on the base," Washington DC Mayor Vincent Gray told CNN.

Alexis left the Navy as a petty officer 3rd class, after serving full-time in the naval reserve from 2007-11, under a general discharge, a status that suggests misconduct.

The victims Michael Arnold, 59

Sylvia Frasier, 53

Kathleen Gaarde, 62

John Roger Johnson, 73

Frank Kohler, 50

Kenneth Proctor, 46

Vishnu Pandit, 61

Martin Bodrog, 54

Arthur Daniels, 51

Mary Francis Knight, 51

Gerald Read, 58

Richard Michael Ridgell, 52 Profiles of the victims

He had been cited for insubordination, disorderly behaviour and excessive absences from work at least eight times during his Navy career, the Washington Post reported on Tuesday.

According to media reports, Alexis was a Buddhist convert who had had previous gun-related brushes with the law.

On Tuesday, his employer, an IT contractor called The Experts, said the military should have made his record known.

"Anything that suggests criminal problems or mental health issues, that would be a flag. We would not have hired him," Thomas Hoshko, chief executive officer of firm, told the Washington Post.

The company confirmed Alexis had worked since July at six different military installations and had only been at the Navy Yard for a few days before the shooting.