Afghan officials said the casualties took place on Tuesday evening when the armed assailants stormed the mosque in Parwan's provincial capital of Charekar and opened fire on the worshipers breaking their fast in the Muslim holy month of Ramadan.
The attack left eight people dead and 12 others injured, with reports saying the gunmen had fled the scene.
No group or individual has so far claimed responsibility for the deadly assault, but the Afghan ministry of interior blamed it on the Taliban militant group.
Earlier on Tuesday, the Taliban launched an attack on Afghan security forces in the northern city of Kunduz, killing eight and injuring several others.
The incident came a week after President Ashraf Ghani ordered the country’s military to resume its operation against the militants following a string of deadly attacks on security forces.
The United Nations has warned of an alarming uptick in violence against civilians and a “striking deterioration” in respect for international humanitarian law in Afghanistan.