American law enforcement officials have confirmed that a gunman at a Washington DC naval yard has died and a second was "down".

Confirmation came after police revealed that four people had been killed in the shooting and at least 10, including two police officers, were injured. .

Witnesses reported that a gunman was standing on the fourth floor of a building and firing at people in the cafeteria three storeys below.

Patricia Ward, a logistics management specialist, said she was in the cafeteria and heard at least seven shots.

"Everybody just panicked at first," she said. "It was just people running, running, running."

The Washington Post reported that three shooters took part in the rampage. Earlier, a shooter was "contained" but was not in custody, according to an unnamed official quoted by the AP.

The incident happened at the Naval Sea Systems Command headquarters, where 3,000 are employed.

President Barack Obama and defence secretary Chuck Hagel were briefed on the situation.

"The president directed his team to stay in touch with our federal partners, including the Navy and FBI, as well as the local officials," the White House said.