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 told the BBC the blast was preceded by the sound of gunfire.


An emergency was declared as hospitals began to receive the wounded, with an appeal sent out for blood donations.


Condemning the incident, Pakistan's Prime Minister Shehbaz Sharif expressed 'deep grief' as he called for a thorough investigation and the immediate identification of those behind the attack.


In separate statements, Pakistan's President Asif Ali Zardari said 'targeting innocent civilians is a crime against humanity', while Defence Minister Khawaja Asif suggested India and Afghanistan were behind the attack.


Asif said in a social media post that it had been 'proven' the attacker had travelled to and from Afghanistan, and 'collusion between India and Afghanistan is being revealed'.


Afghanistan's Taliban government described Khawaja Asif's comments as 'regrettable', saying the Pakistani minister 'hastily attempted to attribute the incident to Afghanistan without presenting any credible evidence'.


Afghan foreign ministry spokesman Abdul Qahar Balkhi earlier condemned the attack and extended condolences, calling such attacks a 'contradiction to Islamic and humanitarian values'.


The Indian foreign ministry also condemned the attack and sent condolences for the loss of life, calling the accusations it may be involved 'baseless'.


Talal Chaudhry, Pakistan's minister of state for interior, said the suspect was not an Afghan citizen, according to local media.


A spokesperson for United Nations Secretary-General Antonio Guterres said he condemned the attack in the 'strongest terms' and called for those responsible to be 'identified and brought to justice'.


Witnesses inside the mosque described the chaos that followed the explosion, with one individual stating that gunfire was heard before the blast disrupted their prayers.


Although attacks in Islamabad are rare, this event happened amidst a week of violence which left dozens dead in the province of Balochistan, attributed to the Balochistan Liberation Army (BLA).


As violence in Pakistan has surged, last year was reported to be the deadliest in over a decade with a 74% increase in combat-related deaths.