This was group's third so-called "revenge" attack for last month's execution of Taliban-linked prisoners. The incident took place in Pul-i-Alam, capital of volatile Logar province. It left 23 prosecutors wounded as they were meeting to take a call over the fate of six newly arrested Taliban militants.
The Taliban gunmen also killed the head of the court. Salim Saleh, the provincial governor's spokesman, said the three gunmen stormed the building of the court and opened firing. "Seven people were killed including Mohammad Akram Nejat, the newly appointed head of the court," he added.
The death toll was confirmed by Hasib Stanakzai, a member of Logar's provincial council.The Taliban claimed that it launched the attack in retaliation for the execution of six Taliban-linked inmates last month.
"The martyrdom attack was carried out in revenge for the execution of our mujahideen," Taliban spokesman Zabihullah Mujahid said on Twitter.
Afghan security forces shot dead the three attackers.