KABUL, Afghanistan — Suicide bombers attacked a Shiite mosque in the western Afghan city of Herat on Tuesday, killing at least 20 people, officials said.

Gen. Ayoub Ansari, the police chief of Herat, said two armed attackers had entered the mosque, killing 20 worshipers and wounding more than 30 others.

Jailani Farhad, a spokesman for the province’s governor, said that at least one of the attackers had blown himself up. Mr. Farhad put the number of dead at 29 and the wounded at 64.

Images circulating on social media showed destruction inside the mosque, and bloodied victims being rescued. Residents rushed to the hospitals to donate blood, while officials reported hundreds of angry protesters marching on a local police checkpoint.