Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A civilian fatally shot a sailor aboard a docked U.S. Navy destroyer in Virginia on Monday night before he was shot dead by security forces, officials said.

The suspect had authorized access to Naval Station Norfolk, the world's largest naval base, where he was able to wrestle a handgun from a security guard, U.S. Navy officials told NBC News.

He shot dead a sailor aboard USS Mahan, which was docked at Pier 1, before being fatally gunned down by security forces, the officials said. Both the victim and suspect were male.

The shooting happened at about 11:30 p.m. and the base was put on lockdown until around 1 a.m. while security forces responded. The Navy officials said it was not clear what sparked the incident.

To get on the base, civilians must be escorted or have a pass. Each base entrance is guarded, and all 13 piers have additional security forces. As part of ongoing security efforts, handheld ID scanners were implemented this year at Navy bases in the region, including the Norfolk station.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Capt. Robert Clark, commanding officer of Naval Station Norfolk, told an earlier press conference that he was not prepared to discuss how the suspect obtained the weapon as it was still under investigation.

"We are investigating it, it's a crime scene as we speak," he said. "We will preserve the scene until investigation is complete."

He said the sailors were not being prevented from going back to work but that it would be a "trying day."

"Will make sure sailors aboard ship have the counselors they need and the people they can talk to," he said.

Clark added that the incident was being investigated by U.S. Navy security forces as well as the Naval Criminal Investigative Service (NCIS), the Navy's primary law enforcement agency.

The USS Mahan is a 505-foot Arleigh Burke-class destroyer commissioned for service in 1998. The ship has a crew of approximately 275 sailors.

The base covers more than 6,000 acres and is the home port for 64 ships, according to information the Navy provided in February. About 46,000 military members and 21,000 civilian government employees and contractors are assigned to the base and its ships, according to the Navy figures.

— Jim Miklaszewski, Alexander Smith and David Wyllie

The Associated Press contributed to this report.