More than 20 security forces were reported killed Saturday in attacks by Taliban militants in various parts of Afghanistan, including Kabul — a sign of the insurgents’ resiliency despite a surge of offensives by U.S. and Afghan forces in recent months.

In Kabul, a suicide bomber on foot detonated explosives attached to his body outside an intelligence agency office near the headquarters of NATO-led troops, Afghan officials said.

Interior Ministry spokesman Nasrat Rahimi said three Afghans were killed and six were wounded, but he did not identify the victims.

The death toll in Kabul could have been higher, but an official for the intelligence agency threw his arms around the bomber before he could reach an area where there was a larger group of officials and civilians, the Interior Ministry’s chief spokesman told The Washington Post.

“He did an amazing job, sacrificed his life to save others by embracing the bomber before he could detonate the explosives,” Najib Danesh said, adding that another intelligence official was also among those killed.

The Kabul attack followed two suicide car-bomb attacks targeting Afghan security forces in two different parts of southern Helmand province, he said. At least four policemen were killed in the two attacks.

The most deadly incident took place in the Bala Boluk district of western Farah province, where 18 troops were killed overnight in their camps, Defense Ministry spokesman Mohammad Radmanesh said.

The Taliban militants claimed responsibility for those two attacks, but not the one in Kabul. The Islamic State, in a statement posted by its affiliated news agency, Amaq, claimed responsibility for the Kabul bombing.

The attacks come after high-profile strikes by the Taliban and the Islamic State in January, when more than 150 people, many of them civilians, were killed in different parts of Kabul.

Those attacks seemingly put a dent in the prospects for peace.

“Believe me, I will take revenge,” President Ashraf Ghani said on Jan. 30, visibly angry after a week of suicide bombings and armed raids that killed more than 100 people and wounded nearly 300 others. The country’s enemies, he said, “should know that Afghans do not have a president who will give in.”

President Trump also seemingly soured on talks with the Taliban. “I don’t think we’re prepared to talk right now,” Trump said then.

In an effort to force the militants to negotiate, Afghan and U.S.-led forces in recent months have ratcheted up ground and aerial offensives. But 10 days ago, the Taliban issued a 17,000-word appeal to the “American people,” asking them to pressure U.S. officials to end the 16-year-old conflict and asserting that the protracted American “occupation” had brought only death, corruption and drugs to the impoverished country.

“Stubbornly seeking the protraction of this war,” the letter added, “will have “dreadful consequences” for the region and the “stability of America herself.”

Pamela Constable contributed to this report.