HONOLULU — A United States sailor opened fire at the Pearl Harbor Naval Shipyard on Wednesday, fatally shooting two shipyard workers and injuring another before killing himself, the authorities said.

The motive for the shooting, which occurred around 2:30 p.m. local time at a dry dock on Joint Base Pearl Harbor-Hickam, was not immediately clear. It was also not clear whether the active duty sailor targeted the three shipyard workers — Department of Defense civilians — or fired indiscriminately.

The sailor was assigned to the U.S.S. Columbia, a submarine docked at the shipyard for maintenance, Rear Adm. Rob ert B. Chadwick II, commander for the Navy in Hawaii, said at a news conference on Wednesday.

The injured shipyard worker was in stable condition, Admiral Chadwick said.

The names of the gunman and the victims will not be released until next of kin are notified, he said.