A US sailor shot dead two workers before taking his own life at the Pearl Harbor military base near Honolulu in Hawaii on Wednesday.
Officials say the gunman also injured a third worker before he killed himself.
The incident prompted a lockdown at Joint Base Pearl Harbor-Hickam, which is on the Hawaiian island of Oahu.
The shooting was reported at about 14:30 (00:30 GMT) local time. The identities of those involved in the shooting have not yet been confirmed.
All three victims were civilian defence department employees and the survivor is in a stable condition, officials said.
Rear Admiral Robb Chadwick, speaking at a press conference, said it was unclear if the victims were targeted or shot at random.
He said the gunman has tentatively been identified as an active duty serviceman assigned to the USS Columbia.
The submarine is currently undergoing maintenance at the base, US media reports.
"Obviously our thoughts are with the families of the victims and everyone involved," Rear Adm Chadwick added.
The shooting prompted a lockdown at the military base, which is home to US navy and air force personnel.
Both base security and the Naval Criminal Investigative Service are investigating the shooting, a spokesman said.
Hawaii's governor, David Ige, responded to the shooting in a tweet and confirmed the White House had offered federal assistance.
I join in solidarity with the people of Hawai‘i as we express our heartbreak over this tragedy and concern for those affected by the shooting. Details are still emerging as security forces at Joint Base Pearl Harbor Hickam investigate. #PearlHarbor— Governor David Ige (@GovHawaii) December 5, 2019
Senator Mazie Hirono also paid tribute to the first responders at the scene.
While the investigation into this incident continues, my thoughts and aloha are with the victims of the terrible tragedy at #JBPHH and with their families. I join all of Hawaii in expressing our gratitude to the first responders who rush toward danger every day to keep us safe— Senator Mazie Hirono (@maziehirono) December 5, 2019
The shooting comes just three days before the 78th anniversary of a Japanese attack on Pearl Harbor naval station, which left more than 2,300 Americans dead.
The surprise attack, on 7 December 1941, prompted the US to declare war on Japan and enter World War Two.