But by Monday evening, the federal authorities said they believed the shooting was the act of a lone gunman, identified as Aaron Alexis, 34, who was working for a military subcontractor.
The chaos at the facility, the Washington Navy Yard, started just after 8 am. Civilian employees described a scene of confusion as shots erupted through the hallways of the Naval Sea Systems Command headquarters, on the banks of the Anacostia River a few miles from the White House and about a half-mile from the Capitol.
"I heard three gunshots, pow, pow, pow, straight in a row," said Patricia Ward, a logistics management specialist from Woodbridge, Va., who was in the cafeteria on the first floor when the shooting started. "About three seconds later, there were four more gunshots, and all of the people in the cafeteria were panicking, trying to figure out which way we were going to run out."
Police officers who swarmed the military facility exchanged fire with Alexis, a former naval reservist in Fort Worth, Texas. Police officers shot Alexis to death, law enforcement officials said, but not before a dozen people were killed and several others, including a city police officer, were wounded and taken to local hospitals.
Officials said Alexis was able to drive a rental car onto the base using his access as a contractor and shot an officer and one other person outside Building 197, the Sea Systems Command headquarters. Inside, Alexis made his way to a floor overlooking an atrium and took aim at employees eating breakfast below.
"He was shooting down from above the people," one law enforcement official said. "That is where he does most of his damage."
The names of seven of the victims were released late on Monday: Michael Arnold, 59; Sylvia Frasier, 53; Kathy Gaarde, 62; John Roger Johnson, 73; Frank Kohler, 50; Kenneth Bernard Proctor, 46; and Vishnu Pandit, 61. Officials said names of the other victims would be released after their families had been contacted. All of the victims were believed to be civilians or contractors. No active duty military personnel were killed, said Chief Cathy L. Lanier of Washington. One victim was shot in the left temple and was pronounced dead within a minute of arriving at George Washington University Hospital.
"This injury was not survivable by any stretch," a hospital official told reporters. "The patient was dead on the way to the hospital."
Eight people were injured. Three of them were shot, including Officer Scott Williams of the Washington police. The others suffered injuries from falls or complained of chest pains. Williams, who served in the canine unit, underwent several hours of surgery for gunshot wounds to his legs. A second victim suffered a gunshot wound to her shoulder. A bullet grazed a third victim's head but did not penetrate her skull, according to doctors at MedStar Washington Hospital Center.
Three weapons were found on Alexis: an AR-15 assault rifle, a shotgun and a semi-automatic pistol, a senior law enforcement officer said. It was unclear whether he had brought all the guns with him, another law enforcement official said, or if he had taken one or more of them from his victims. Officials said they were still searching for a motive as they asked the public for help by posting pictures of Alexis on the FBI website. The FBI is treating the shooting as a criminal investigation, not one related to terrorism.
Navy officials said late Monday that Alexis had worked as a contractor in information technology. A spokesman for Hewlett-Packard said Alexis had been an employee of a company called The Experts, a subcontractor on an HP Enterprise Services contract.
Navy officials said Alexis was given a general discharge in 2011 after exhibiting a "pattern of misbehaviour," which officials declined to detail. The year before, Alexis was arrested in Fort Worth for discharging a firearm after an upstairs neighbour said he had confronted her in the parking lot about making too much noise, according to a Fort Worth police report.
The police in Seattle, where Alexis once lived, said Monday that they had arrested him in 2004 for shooting the tires of another man's vehicle in what Alexis later described to detectives as an anger-fuelled "blackout."
Eleanor Holmes Norton, the congressional delegate for the District of Columbia, called the episode "an attack on our city."
"It's an attack on our country," she added.
Mayor Vincent C Gray called it a "long, tragic day." President Barack Obama praised the victims of the shooting as patriots.
The tension in the city was heightened for much of the day as the city's police said they were still unsure whether Alexis had acted alone. Officials said surveillance video of people fleeing the scene of the shooting showed two armed men dressed in different military uniforms and wielding guns. For hours, the police said they believed that there might have been three gunmen and that two of them were on the loose in the city.
The reports of multiple suspects generated confusion across Washington as the authorities offered conflicting messages about any continuing danger. Officials did not move to secure the city, leaving the city's subway system to operate normally. But out of an "abundance of caution," Terrance W Gainer, the Senate sergeant-at-arms, put the Senate complex into lockdown after 3 pm. The Senate had recessed in the early afternoon.
Around the same time, the Washington Nationals postponed a game against the division-leading Atlanta Braves, which had been scheduled for 7 pm at Nationals Park, next to the Navy Yard. The Nationals' website said "Postponed: Tragedy" and notified fans that the teams would play a doubleheader on Tuesday instead.
The city was further shaken Monday evening when someone tossed firecrackers over the fence at the White House, causing loud bangs and prompting a swift and aggressive response from Secret Service agents, who tackled a man in white shorts and a T-shirt on Pennsylvania Avenue.
The Navy Yard is protected by a high wall, but someone with official access could have driven a car into the parking lot without having the trunk inspected.