"This is a horrific tragedy," Mayor Vincent Gray said.
The FBI also said Tuesday Alexis had a shotgun when he entered the building and got a handgun inside after he started firing. Valerie Parlave, head of the FBI's field office in Washington, said they don't have any information that he had an AR-15 assault rifle in his possession.
For much of the day Monday, 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.
President Barack Obama lamented yet another mass shooting in the U.S. that he said took the lives of American "patriots." He promised to make sure "whoever carried out this cowardly act is held responsible."
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.
At the time of the rampage, Alexis was an employee with The Experts, a company that was a Defense Department subcontractor on a Navy-Marine Corps computer project, authorities said.
Parlave said Alexis had access to the Navy Yard as a defense contractor and used a valid pass.
The Washington Navy Yard is a sprawling, 41-acre labyrinth of buildings and streets protected by armed guards and metal detectors, and employees have to produce 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.
Associated Press writers Matt Apuzzo, Adam Goldman, Jesse Holland, Stacy A. Anderson, Brian Witte and Ben Nuckols in Washington contributed to this report.
- Ex-MLB hurler winds up for Vermont governor...
- Obama: World leaders rightfully 'rattled' by...
- Delegates in hand, Trump says he's got GOP...
- Court upholds $3M judgment against Gerber...
- UN envoy to Syria: Peace talks not set to...
- Origin of key Clinton emails from report are...
- McDonald's CEO says company is making...
- CDC urges speed on Zika as House moves to...
- Are Utahns tiring of Mitt Romney... 109
- Why the University of Miami plans to... 45
- Utah and 10 states sue Obama... 40
- Delegates in hand, Trump says he's got... 33
- Obama: World leaders rightfully... 29
- In Hiroshima, Obama honors 'silent cry'... 25
- Donald Trump breaks with nation's only... 17
- Trump tells California 'there is no... 17