A gunman sprayed the interior of a mosque with bullets in the eastern Nangarhar province of Afghanistan, killing four, an official said.
Three more people, including the mosque's religious leader, were wounded in the attack, Attahullah Khogyani, the provincial governor's spokesman said.
The assault took place on Sunday evening in the district of Surkh Rod.
No one immediately claimed responsibility for the attack, but the Taliban and ISIS militants are active in eastern Afghanistan.
On Sunday, a suicide bomber killed 23 while targeting the convoy carrying Afghanistan's Vice President Abdul Rashid Dostum as he was returning from Turkey after a year in exile.
General Dostum, a former Uzbek warlord, and his entourage were unhurt. ISIS claimed responsibility for the bombing.