A police officer patrols outside the US Navy Yard September 16, 2013 in Washington, …

A former US naval reservist opened fire at a base in the heart of Washington on Monday, killing 12 people and exchanging fire with police before losing his own life.

Police identified the alleged shooter as 34-year-old Aaron Alexis, of Forth Worth, Texas, who served full-time in the Navy from 2007 to 2011 before becoming a defense contractor.

The Federal Bureau of Investigation appealed to the public for information on the suspect, whose military service was marked by misconduct and who reportedly had once been arrested but not charged in Texas for shooting a bullet through his apartment ceiling.

"No piece of information is too small. We are looking to learn everything we can about his recent movements, his contacts and his associates," said Valerie Parlave, assistant director of the FBI's Washington field office.

The FBI released a photo of Alexis, an African-American who held the rank of an Aviation Electrician's Mate 3rd Class and had served full-time in a logistics support squadron in Forth Worth, according to the Navy.

Alexis reportedly had expressed an interest in Buddhism, friends told local media in Texas, while his four-year stint in the Navy was troubled.

"There is definitely a pattern of misconduct during his service," a US military officer, who spoke on condition of anonymity, told AFP.

The Navy had yet to release the precise nature of the suspect's work as a contractor.

The shooting sparked a massive show of force as police and federal agents descended on the Navy Yard, cordoning off streets only blocks from the US Capitol, home of Congress.

Officials gave no indication of any link to terrorism but said the motive for the attack on the installation was unknown.

President Barack Obama ordered that flags be flown at half mast in the US capital until Friday as a mark of respect for the dead.

Obama called the shooting a "cowardly act" and lamented that America was confronting "yet another mass shooting," saying troops in the military should not have to confront danger at home.

Washington DC Mayor Vincent Gray said "we don't have any reason at this stage to suspect terrorism, but certainly it has not been ruled out."

He announced the number of dead from the shooting was at 13, with about dozen more wounded, including a police officer.

A second suspect was still being sought, an African-American male aged 40 to 50, clad in an olive-drab military-style uniform, authorities said.

Washington city police chief Cathy Lanier asked "that people stay out of the area until we give the all-clear."

Earlier media reports had said the shooter was armed with an assault rifle and had allegedly barricaded himself in a room in a headquarters building.

After the first reports of shots came at 8:20 am (1320 GMT) in the headquarters building of the Naval Sea Systems Command, police arrived within three minutes and exchanged fire in "multiple engagements" with the suspect, Lanier said.

It was unclear how the attacker could have penetrated the heavy security that surrounds the Navy Yard, which is located on the Anacostia River, less than two miles (three kilometers) from the Capitol.

But the suspect's work as a naval contractor raised the possibility that he had a pass that could gain him entry to the Naval Sea Systems Command, which oversees ship-building programs tcarried out by defense firms.

A Washington police officer was among those injured in the rampage, and hospital officials said he suffered serious wounds to his legs but was expected to survive.

One employee at the Navy Yard, Patricia Ward, said she had just paid for her breakfast at a cafeteria when shots rang out.

"I was waiting for my friend to pay when we heard the gun shot. It was three gun shots straight in a row, 'pow-pow-pow,'" she told reporters.

"Three seconds later it was 'pow-pow-pow.' So it was like a total of seven gun shots. And we just started running."

As helicopters swarmed overhead, police earlier blocked off intersections around the Navy Yard and patrol boats moved in near the site along the banks of the Anacostia river.

Flights out of the nearby Reagan National Airport were briefly delayed and schools were on lockdown until anxious parents came to pick up their children in the afternoon.

The US Senate adjourned for the day as a precaution, and Washington's baseball team, the Nationals, whose stadium is adjacent to the Navy Yard, called off its Monday evening game.

About 3,000 people work at the naval facility, which dates back to the early 1800s and includes a naval history museum.

The complex also has a residence which serves as the home of the four-star chief of the US Navy, Admiral Jonathan Greenert.