Ahmad Wali Tahiri, a government prosecutor and brother of Afghanistan’s national security adviser, was killed Wednesday in an attack claimed by Taliban insurgents.

Tahiri, who served as a prosecutor in the relatively peaceful western province of Herat, was fatally shot outside a public bath by two gunmen who then fled the scene, provincial officials said.

Taliban spokesman Qari Mohammad Yousuf said in an e-mail that the insurgents were behind the attack, which he described as part of the militants’ spring offensive.

Yousuf said Tahiri was targeted because he had served as an attorney for years. He did not link the assassination to long-standing criticism by Tahiri’s brother, Rangeen Dadfar Spanta, of the insurgents and Pakistan, where most of the militants’ leadership is believed to be based.

In the past, militants have killed civil servants or their family members as part of their campaign against the central government and U.S.-led troops.

In a statement, Afghan President Hamid Karzai described Tahiri as a patriot who had never left Afghanistan during its decades of turmoil. He said Tahiri’s killing was part of a “series of murders conducted by foreign intelligence” targeting Afghans, such as tribal chiefs, government officials and their relatives.