“In these times, our photos Live longer than ourselves.’’

Those two lines of verse, posted on the Facebook page of Ramazan Hussainzada last month, proved sadly prophetic. Mr. Hussainzada, a prominent Kabul businessman and philanthropist, was among four people killed by a suicide bomber who blew himself up at Al Zahra mosque in the Afghan capital on Thursday night.

The attack was the latest outrage attributed to Afghanistan’s small but growing wing of the Islamic State, which claimed responsibility in a message on Telegram, a WhatsApp-like service, noting pointedly that the mosque was a Shiite one.

While Afghanistan’s many ethnic factions have long warred among themselves, in recent years they have taken pains to play down differences between the majority Sunnis and minority Shiites, who are mostly members of the Hazara ethnic group.

A spokesman for the Taliban, Zabihullah Mujahid, immediately repudiated the attack on the mosque.

“We are not attacking mosques and our Shiite brothers,” Mr. Mujahid said, reached over the social messaging service Viber.