Kabul, Afghanistan (CNN) Four Americans were killed in an apparent suicide bomb attack early Saturday at Bagram Airfield, the largest US base in Afghanistan, US Defense Secretary Ash Carter said.

Two of those killed were service members, and two were contractors, he said, adding he was "deeply saddened" by the news.

The explosion also wounded 16 other US service members and one Polish soldier participating in the NATO mission, Carter said in a statement.

The Taliban claimed responsibility in a tweet praising the "strong attack" on Bagram Airfield.

In a statement, Taliban spokesman Zabihullah Mujahid said a suicide bomber had targeted "a sports ground where more than 100 military officers, important people and soldiers were busy exercising."

The ancient city of Bagram is more than 30 miles north of the Afghan capital, Kabul.

The attack on the airfield had been planned for four months, he said.

A NATO coalition official told CNN that the bomber, who is presumed dead, detonated the suicide bomb vest on a sidewalk near where people were preparing for a run.

The base was under lockdown, and additional security measures were instituted at all other locations in Afghanistan for the United States and coalition allies, the official said.

The US Embassy in Kabul will be closed Sunday, except for emergency consular services, as a precautionary measure, the State Department said. In a tweet, the department cited the "serious threat violence, kidnapping and hostage taking."

Carter offered his condolences to the families of those killed and said the injured were getting the best possible care.

"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," he 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."

NATO chief: 'United against terrorism'

NATO earlier said 14 people were injured in the blast , which happened shortly after 5:30 a.m. local time. Its force protection and medical teams responded.

NATO Secretary General Jens Stoltenberg offered his support on Twitter to those affected by the attack.

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

"NATO remains committed to our mission to train and support the Afghan forces. We all stand united in the fight against terrorism," he said in a statement.

The airfield is next to the ancient city of Bagram, southeast of Charikar in Parwan province. Bagram is more than 30 miles (48 kilometers) north of Kabul, the Afghan capital.

Afghan President Mohammad Ashraf Ghani condemned the attack in a statement Saturday, calling it a "cowardly" act by terrorists "who have no regard for Islam, human life or the future of Afghanistan." He reiterated his intention to "destroy the enemies" of his country and its allies, and vowed to bring the perpetrators to justice.

Questions over security

Urgent investigations are being carried out at the base, and security has been tightened, according to CNN Pentagon correspondent Barbara Starr. The military will want to ensure that anyone tied to the blast is found before people are allowed to leave the base.

Bagram Airfield is the largest US military base in Afghanistan.

"The question now is, how did someone get inside?" she said. "There's very strict security at these bases. ... If you come in a vehicle, you are stopped well before the outside gate. Vehicles are searched, people are searched, people must have ID -- so it's very difficult to understand right now how this happened."

There are about 14,000 people on the Bagram base, with about 60% contractors, according to Starr. Locals move on and off the base in some contractor roles, she said.

Security breaches at coalition bases in Afghanistan have occurred but are rare, she added.

Recent violence

Saturday's blast follows a spate of recent attacks.

suicide car bomb targeted the German Consulate in Afghanistan's northern Balkh province on Thursday, according to local police and officials.

JUST WATCHED Afghan forces battle Taliban for control of Kunduz Replay More Videos ... MUST WATCH Afghan forces battle Taliban for control of Kunduz 01:38

Monir Ahmad Farhad, a provincial spokesman, said four people were killed and more 100 people were injured in the attack in Mazar-e-Sharif, the provincial capital. No German diplomats were hurt. The Taliban claimed responsibility for the attack.

Last week, a joint Afghan-US battle against the Taliban in the northern district of Kunduz killed 30 civilians as well as two US soldiers and 26 militants.

Those deaths happened the same day Taliban mortars killed at least seven people at a wedding party in Faryab province in northern Afghanistan, police spokesman Kareem Youresh said. At least 13 people were wounded.