At least 31 people have been killed and 169 injured in an explosion at a mosque during Friday prayers in Pakistan's capital, Islamabad, officials say.

According to police, a suicide bomber detonated a device after approaching the gates of the Shia mosque in the Tarlai area of the city. Eyewitnesses have reported that the blast was preceded by the sound of gunfire.

An emergency has been declared as hospitals began to receive the wounded, with an appeal for blood donations. Pakistan's Prime Minister Shehbaz Sharif expressed deep grief over the incident and called for a thorough investigation.

Condemnations have poured in from various officials, with President Asif Ali Zardari labeling the attack a crime against humanity. Defence Minister Khawaja Asif alleged that India and Afghanistan could be involved, which drew a sharp response from the Taliban government of Afghanistan.

Witnesses described chaotic scenes inside the mosque following the explosion, with many people injured and disoriented. Zaheer Abbas, an eyewitness, recounted hearing gunfire before the explosion, stating, After that, we bowed and then prostrated, and then there was an explosion. After which there were injured people lying everywhere.

Authorities are investigating whether the suspected terrorist had links to Afghanistan, while Afghanistan's foreign ministry condemned the remarks of Pakistan’s officials as unfounded. The Indian government also expressed its condolences and refuted allegations of complicity.

The attack follows a week of violence in Pakistan, which has seen multiple civilian casualties, raising concerns over escalating security threats in the region. Last year was noted as Pakistan's deadliest year in over a decade, highlighting a troubling trend of rising violence by militants.