Four Americans were killed and 17 troops and contractors were wounded while participating in a Veterans Day 5K run when an apparent lone attacker managed to detonate a deadly bomb inside the sprawling Bagram military base in Afghanistan yesterday, counterterrorism officials told ABC News today.

The U.S. military’s Operation Resolute Support provided few details beyond confirming that a blast inside the base had left two U.S. service members and two American contractors dead along with 16 American troops and a Polish trooper wounded.

Bagram Airfield is home to nearly 14,000 military forces and contractors.

But officials in Washington and various U.S. military commands have been told that the victims were participating in a 5K run celebrating Veterans Day, two counterterrorism officials told ABC News.

A coalition official later told ABC News that the attacker used a belt or vest bomb in the attack.

The attacker was a former Taliban militant who had joined the peace process in 2008 and had since taken a job at the base, Bagram District Governor Haji Abdul Shokor Qudosi told ABC News on Sunday.

Neither the exact nature of the attacker’s work on the base, nor when he began working there is known. It is common for local residents to take jobs like day laborers, cleaners and cook assistants at the facility.

The district governor told ABC News that Afghan security forces had raided the attacker’s residence in the Laghmani village and had detained two of his relatives for further investigation.

Meanwhile, the U.S. embassy in Kabul was closed “for routine services” on Sunday in wake of the attacks on Bagram Airfiled and an earlier attack on a German Consulate in Mazar-e-Sharif, according to a communique from the State Department.

The State Department said that the embassy “continues to receive reports of militants planning unspecified attacks in Kabul City and elsewhere in Afghanistan against locations and individuals with potential American connections.”

As part of standard operating procedure, outside communications at the military base are temporarily shut off after deadly attacks.

The Afghan Taliban claimed responsibility in a statement today, claiming much higher casualties.

“I am deeply saddened to learn that an explosion early this morning at Bagram Airfield in Afghanistan has resulted in U.S. casualties. An apparent suicide bomber has taken the lives of two U.S. service members and two U.S. contractors working on the base,” Secretary of Defense Ash Carter said in a statement today.

“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,” Carter said.

“To the family and friends of those who lost their lives today, we share your loss and our thoughts are with you. 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,” said Army General John W. Nicholson, Commander of Resolute Support. “To those who target Coalition forces, ANDSF, and Afghan civilians, Resolute Support and USFOR-A will continue to pursue our Train, Advise, and Assist mission to help our partners create a better Afghanistan.”

The deadly bombing appears to be unprecedented in the 15-year Afghan War. Past attacks on various gates and checkpoints at Bagram, an hour’s drive north of the capital Kabul, have never succeeded in penetrating the many layers of security.

In 2007, a suicide bomber killed 22 civilians and Army Pfc. Daniel Zizumbo during a coincidental visit by then-Vice President Richard Cheney. After a stop by President Obama to visit with troops at Bagram Airfield in 2010, the Taliban lobbed rockets at the base.

In both cases, the Afghan Taliban claimed falsely that Cheney and Obama had been the targets, which American officials denied.

The most serious breach of security at Bagram known to have occurred was in July 2005 when four senior al-Qaeda operatives succeeded in escaping a prison located on the flight line.

ABC News’ Lucien Bruggeman contributed reporting.