More than 20 people have been killed and several others injured in a powerful explosion inside a mosque belonging to Shia Muslims in western Afghanistan.

The deadly bomb attack was carried out in the city of Herat, the capital of a province with the same name, late on Tuesday.

Medical sources said over 20 bodies had been brought to the main Hospital in Herat soon after the blast.

"More than 20 bodies, and more than 30 wounded have so far been brought to the hospital," media outlets quoted hospital spokesman, Rafeeq Shirzai, as saying.

Some local Afghan media reports put the death toll at 33. Some of the injured are said to be in critical condition.

Shia Muslims have remained a constant target of militant attacks across various parts of the country over the past few months.

On July 24, over two dozen people were killed and more than 40 wounded after a car bomb attack claimed by the Taliban struck a bus transporting government employees through a Shia neighborhood in the capital Kabul. The bus was struck as it passed through a busy area of the city that is home to many Shia Hazara Muslims, a persecuted ethnic community.

Also in mid-June this year, Takfiri terrorists killed several people and wounded several others in a bomb attack at a Shia mosque in Kabul. The casualties were caused after an assailant detonated his explosives when he was prevented from entering al-Zahra mosque in western Kabul. The Daesh Takfiri terrorist group claimed responsibility for the attack.

In November 2016, a bomber blown himself up inside a Shia mosque in Kabul, killing at least 27 people and wounding dozens of others. The explosion happened at the Baqir-ul-uloom mosque in the Darul Aman area as people gathered for a religious ceremony.

Afghan mourners and relatives pray in front of the coffin of one of the 26 victims killed in a car bombing in Kabul on July 25, 2017. (Photo by AFP)

One year ago, a massive bomb blast killed at least 84 people, most of them Shia Hazara, as they were holding a rally to demand better life conditions.

Afghanistan is still suffering from insecurity and violence years after the United States and its allies invaded the country in 2001 as part of Washington’s so-called war on terror. The invasion removed the Taliban from power, but militancy still rages on in the country.

In recent months, Daesh has been making inroads in Afghanistan through alliances with local militant outfits.