NYPD Commissioner William Bratton said that Joseph Lemm, 45, who was married with three children, was a 15-year veteran of the NYPD who had received the gold shield of a detective in January 2014 and was assigned to the Bronx Warrant Squad.

"Detective Joseph Lemm epitomized the selflessness we can only strive for -- putting his country and city first," Bratton said in a statement. "Tonight, we grieve and we remember this selfless public servant who dedicated his life to protecting others."

Lemm was on his second tour with the Air National Guard in Afghanistan. He also had deployed to Iraq. Lemm was the third member of the NYPD to be killed in Iraq or Afghanistan, an NYPD spokeswoman said.

Members of the NYPD and other police departments around the country have joined the Guard and Reserves in significant numbers since the Sept. 11, 2001, terror attacks. The spokeswoman said that 130 members of the department currently are deployed and more than 4,200 are veterans.

Field commanders in Iraq and Afghanistan have frequently called on NYPD members and Guard and Reserve troops from other police departments to train local police in Iraq and Afghanistan.

Lemm and five other service members were killed Monday while on foot patrol near the Bagram airbase north of Kabul when a Taliban suicide bomber on a motorcycle detonated explosives next to the patrol, U.S. military officials said.

Two other U.S. troops and an Afghan interpreter were wounded in the attack. The military was withholding the identities of the other five fatalities until their families could be notified.

"Our heartfelt sympathies go out to the families and friends of those affected in this tragic incident, especially during this holiday season," Army Brig. Gen. William Shoffner, a spokesman for NATO's Resolute Support mission in Kabul, said in a statement.

Defense Secretary Ashton Carter called the attack "a painful reminder of the dangers our troops face every day in Afghanistan" against a resurgent Taliban and the new threat from the growing presence of the Islamic State of Iraq and Syria, or ISIS, in southeastern Afghanistan.

President Barack Obama was on vacation in Hawaii, where the White House issued a statement condemning the "cowardly attack" while pledging that the U.S. would "remain committed to supporting the Afghan people and their government."

The attack near the largest U.S. facility in Afghanistan was the deadliest on foreign troops or civilians in four months. On Aug. 22, three American contractors were killed in a suicide attack in Kabul.

On Aug. 7 and 8, Kabul was the scene of three insurgent attacks within 24 hours that left at least 35 people dead. One of the attacks, on a U.S. special operations forces base outside Kabul, killed one U.S soldier and eight Afghan civilian contractors.

A total of 22 U.S. troops, two from Britain and three from other countries have died in Afghanistan this year, according to the website icasualties.org. Ten of the American fatalities this year were the result of hostile activity, and another 68 were wounded, according to the Washington Post.

Currently, there are about 9,800 U.S. troops in Afghanistan serving in a NATO mission known as "Resolute Support" to train, advise and assist Afghan military forces, with about 5,500 of them are stationed at Bagram. Obama has pledged to keep at least 5,500 U.S. troops in Afghanistan through 2016 and keep support for the Afghan government at about $4.1 billion.

The attack near Bagram came as the Taliban made gains in southwestern Helmand province, threatening the provincial capital of Lashkar Gah. On Monday, Afghan Defense Ministry spokesman Dawlat Waziri said Afghan Army commandos and special forces had arrived in Helmand’s Sangin district to begin a counter-offensive.

During a visit to Afghanistan last week by Defense Secretary Carter, Army Gen. John Campbell, the U.S. and NATO commander in Afghanistan, noted that he no longer used the term "fighting season" which previously was used to descrive the spring and summer months in Afghanistan.

"We just went through a very, very tough fighting season," Campbell said, and then added that "We don't even talk in terms of fighting seasons anymore because it's kind of continuous fighting."