WASHINGTON -- The deadly attack at the Washington Navy Yard was carried out by one of the military's own: a defence contract employee and former Navy reservist who used a valid pass to get onto the installation and started firing inside a building, killing 12 people before he was slain in a gun battle with police.

The motive for the mass shooting -- the deadliest on a military installation in the U.S. since the tragedy at Fort Hood, Texas, in 2009 -- was a mystery, investigators said. But a profile of the lone gunman, 34-year-old Aaron Alexis, was coming into focus. He was described as a Buddhist who had also had flares of rage, complained about the Navy and being a victim of discrimination, and had several run-ins with law enforcement, including two shootings.

The latest mass shooting quickly reignited the debate over gun control in the United States. President Barack Obama lamented "yet another mass shooting" in the U.S. and promised to make sure "whoever carried out this cowardly act is held responsible." Obama has been powerless to get gun control legislation passed by Congress amid a fierce backlash from conservative politicians and the gun owners lobby.

Monday's onslaught at a single building at the highly secure Navy Yard unfolded about 8:20 a.m. in the heart of the U.S. capital, less than 6.4 kilometres from the White House and 3.2 kilometres from the Capitol.

It put all of Washington on edge. Mayor Vincent Gray said there was no indication it was a terrorist attack, but he added that the possibility had not been ruled out.

"This is a horrific tragedy," he said.

Alexis carried three weapons: an AR-15 assault rifle, a shotgun, and a handgun that he took from a police officer at the scene, according to two federal law enforcement officials who spoke on condition of anonymity because they were not authorized to discuss the investigation.

The AR-15 is the same type of rifle used in last year's mass shooting at a Newtown, Connecticut, elementary school that killed 20 students and six female staffers. The weapon was also used in the shooting at a Colorado movie theatre that killed 12 and wounded 70.

It was far from certain what impact the latest mass shooting would have on the debate over gun control in the United States.

The politics of gun control have only gotten tougher since December's shooting at Connecticut's Sandy Hook Elementary School. That shooting spurred Obama to propose stricter firearms laws that failed to pass in the Senate.

White House spokesman Jay Carney on Monday reiterated the Obama administration's commitment to strengthening gun laws, including expanding background checks to sales online and at gun shows.

Gun owners, aided by their advocates at the National Rifle Association, the country's largest gun rights lobby, have successfully fought Obama's legislation, even though polls show broad support for tougher gun laws.

For much of the day, authorities said they were looking for a possible second attacker who may have been disguised in an olive-drab military-style uniform. But by late Monday night, they said they were convinced the shooting was the work of a lone gunman, and the lockdown around the area was eased.

"We do now feel comfortable that we have the single and sole person responsible for the loss of life inside the base today," Washington police Chief Cathy Lanier said.

The FBI took charge of the investigation.

The attack came four years after Army psychiatrist Maj. Nidal Hasan killed 13 people at Fort Hood in what he said was an effort to save the lives of Muslims overseas. He was convicted last month and sentenced to death.

In addition to those killed at the Navy Yard, eight people were hurt, including three who were shot and wounded, according to the mayor. Those three were a police officer and two female civilians, authorities said. They were all expected to survive.

The dead ranged in age from 46 to 73, according to the mayor. A number of the victims were civilian employees and contractors, rather than active-duty military personnel, the police chief said.

At the time of the rampage, Alexis was an employee with The Experts, a company that was a Defence Department subcontractor on a Navy-Marine Corps computer project, authorities said.

Valerie Parlave, head of the FBI's field office in Washington, said Alexis had access to the Navy Yard as a defence contractor and used a valid pass.

Alexis had been a full-time Navy reservist from 2007 to early 2011, leaving as a petty officer third class, the Navy said. It did not say why he left. He had been an aviation electrician's mate with a unit in Fort Worth.

A convert to Buddhism who grew up in New York City, Alexis had had run-ins with the law over shooting incidents in 2004 and 2010 in Fort Worth and Seattle and was portrayed in police reports as seething with anger.

The Washington Navy Yard is a sprawling, 16.6-hectare labyrinth of buildings and streets protected by armed guards and metal detectors, and employees have to show their IDs at doors and gates. More than 18,000 people work there.

The rampage took place at Building 197, the headquarters for Naval Sea Systems Command, which buys, builds and maintains ships and submarines. About 3,000 people work at headquarters, many of them civilians.

Witnesses on Monday described a gunman opening fire from a fourth-floor overlook, aiming down on people on the main floor, which includes a glass-walled cafeteria. Others said a gunman fired at them in a third-floor hallway.

Patricia Ward, a logistics-management specialist, said she was in the cafeteria getting breakfast.

"It was three gunshots straight in a row -- pop, pop, pop. Three seconds later, it was pop, pop, pop, pop, pop, so it was like about a total of seven gunshots, and we just started running," Ward said.

Todd Brundidge, an executive assistant with Navy Sea Systems Command, said he and co-workers encountered a gunman in a long hallway on the third floor. The gunman was wearing all blue, he said.

"He just turned and started firing," Brundidge said.

Terrie Durham, an executive assistant with the same agency, said the gunman fired toward her and Brundidge.

"He aimed high and missed," she said. "He said nothing. As soon as I realized he was shooting, we just said, 'Get out of the building."'

As emergency vehicles and law enforcement officers flooded the streets, a helicopter hovered, nearby schools were locked down and airplanes at Reagan National Airport were grounded so they would not interfere with law-enforcement choppers.

Security was tightened at other federal buildings. Senate officials shut down their side of the Capitol. The House of Representatives remained open.

After authorities determined late Monday that the available evidence indicated the deceased shooter acted alone, Sergeant at Arms Terrance Gainer said all operations at the Senate would return to normal Tuesday.

In the confusion, police said around midday that they were searching for two accomplices who may have taken part in the attack -- one carrying a handgun and wearing a tan Navy-style uniform and a beret, the other armed with a long gun and wearing an olive-green uniform. Police said it was unclear if the men were members of the military.

But as the day wore on, police dropped one person and then the other as suspects. As tensions eased, Navy Yard employees were gradually released from the complex, and children were let out of their locked-down schools.

Adm. Jonathan Greenert, chief of naval operations, was at the base at the time the shooting began but was moved unharmed to a nearby military installation.

Associated Press writers Jesse Holland, Stacy A. Anderson, Brian Witte and Ben Nuckols in Washington contributed to this report.

Key facts and figures for U.S. mass shootings

The FBI defines a “mass shooting” as a single incident in which at least four people are killed, not including the shooter.

By that definition, the United States suffers a mass killing every two weeks.

A March 2013 study by the U.S. Congressional Research Service examined shooting sprees in public places, where victims were selected “somewhat indiscriminately.”

Looking at data going back to 1983, the report identified 78 shooting rampages matching that definition.

Those public mass killings left a total of 547 people dead and 476 injured.

The deadliest mass shooting in U.S. history was the 2007 Virginia Tech killing spree, in which 32 people were fatally shot.

-- CTVNews.ca Staff