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

A man wearing a suicide vest killed two U.S. service members and two U.S. contractors inside the largest NATO military base in Afghanistan early Saturday, the Pentagon said.

Another 16 U.S. service members and one Polish soldier were injured in the blast at Bagram Airfield, Defense Secretary Ash Carter confirmed in a statement.

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

"Force protection is always a top priority for us in Afghanistan, and we will investigate this tragedy to determine any steps we can take to improve it," Carter said. "For those who carried out this attack, my message is simple. We will not be deterred in our mission to protect our homeland and help Afghanistan secure its own future."

Afghan National Army soldiers keep watch outside the Bagram Airfield entrance gate after an explosion at the NATO air base, north of Kabul, Afghanistan, Nov. 12. OMAR SOBHANI / Reuters

The attack occurred around 5:30 a.m. local time as people were gathering for a post-Veterans Day fun run.

There was no immediate word on the identities of the victims. The Taliban claimed responsibility for the blast, according to The Associated Press, which quoted a spokesman who said they have been planning the coordinated carnage for four months.

The suicide bomber chose the time and location because he "was looking for an opportunity to do the most damage," a senior U.S. military official told NBC News.

"To the family and friends of those who lost their lives today, we share your loss and our thoughts are with you," U.S. Army General John W. Nicholson said in the statement. "We offer you our deepest condolences. For the family and friends of those wounded in today’s attack, let me assure you they are receiving the best care possible, and we will keep them in our thoughts today."

My thoughts go to the loved ones of those killed at #Bagram Airfield & the wounded. #NATO stands w/ #Afghanistan in the fight against terror — Jens Stoltenberg (@jensstoltenberg) November 12, 2016

The base was put on lockdown following the attack.

Bagram Airfield features several layers of security, including retinal scans. It was unclear how someone got into the base with a suicide vest.