The death toll from a coordinated militant attack on Imam Zaman Mosque in the north of Kabul raised to more than 30, security sources confirmed.
Over 80 others were wounded in the attack and meanwhile more than 100 others were rescued, the sources said.
The Ministry of Public Health however said more than 20 people were killed and over 35 others were wounded in the attack.
But the ministry spokesman Ismail Kawoosi said the casualties may increase - after they received final information on the incident.
The attack started at 1pm on Friday afternoon when a group of three or four attackers entered the mosque when at least 200 worshippers including women were busy in Friday prayers.
The attackers killed two security guards and wounded two others by throwing hand grenades at them in the entrance of the mosque, the Interior Ministry officials said.
Eyewitnesses said the security forces arrived at the scene two hours following the attack. However, the Interior Ministry spokesman Najib Danish said the Crisis Response Unit of the Afghan National Police arrived at the attack scene sharply after it happened.
Many explosions were later heard from the area during the clearance operation by the Crisis Response Unit.
Danish said police rescued more than 100 worshippers who were caught in the fight between security forces and the attackers.
The attack on Imam Zaman Mosque in Kabul's PD11 continued for five hours.
"The attack was carried out by three or four men and that one of them blew himself up outside the mosque, according to initial information," Danish told.
According to him, at least 12 people were killed and 38 others were wounded in the attack.
President Ashraf Ghani in a statement condemned the attack and called it a crime against the people of Afghanistan.
The president called on Afghan religious scholars to raise their voice against such violent acts - carried by terrorists, the Presidential Palace said in a statement.
This is not the first attack on sacred places in the country. At least six people were killed when Al-Zahra Mosque in the west of Kabul was targeted by a blast in mid-June.
Earlier this month, at least 29 people were killed and dozens others were wounded in an attack on Jawadia Mosque in Herat city in Afghanistan's west.