Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

By Ahmed Mengli and Associated Press

KABUL — An explosion inside a mosque in eastern Afghanistan has killed 14 people and injured 36.

NBC News has learned the explosion was caused by an improvised explosive device, which was detonated as civilians waited for prayers at the mosque in the city of Khost.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

At the time of the explosion, the mosque was also being used a voter registration facility.

No one immediately claimed responsibility for the attack, but both the Taliban and a local ISIS affiliate reject democratic elections and have targeted them in the past.

ISIS is not known to have a presence in Khost, but has expanded its footprint into other areas in recent years.

Last month, an ISIS-inspired suicide bomber attacked a voter registration center in Kabul, killing 60 people and wounding at least 130 others.

Afghanistan plans to hold elections in October, the first in the country since 2014.

The Taliban and ISIS have launched a relentless wave of attacks since the start of the year, killing scores of civilians in the capital, Kabul, and elsewhere.

Afghan security forces have struggled to combat the groups since the U.S. and NATO concluded their combat mission at the end of 2014, switching to a counter-terrorism and support role.