Pakistani media reported a suicide bombing attack on a Shiite mosque in Islamabad on Thursday afternoon, with at least 31 fatalities and 169 injuries.

The attack occurred at the Tarlai Imambargah mosque in the Shehzad Town district of Islamabad, the capital city of Pakistan. According to local media reports, the attacker sought to gain entry to the mosque during worship services, but was stopped at the main gate by guards. The bomber still managed to kill dozens of people by detonating at the gate, but the carnage would have been much worse if the blast had occurred inside the crowded building.

Eyewitnesses reported hearing gunfire outside the mosque before the “massive explosion.”

“I heard the gunshots and I was just trying to make sense of what ‌had happened when there was a massive explosion. It threw people here and there. There was smoke. No one knew what had happened. Then there was blood everywhere,” mosque attendee Sarfraz Shah told Reuters. He said his younger brother was killed in the explosion.

The Islamabad Inspector General of Police declared a citywide state of emergency after the attack, while rescue workers raced to get injured victims to nearby hospitals for treatment. Several events related to the kite-flying spring festival of Basant were canceled after the bombing.

Police officials said the attack was the worst in over a decade for Islamabad, which has relatively tight security as the national capital. Shiite Muslims are a minority in Pakistan, which is predominantly Sunni Muslim. Some observers said the attack had the hallmarks of an operation by ISIS, a Sunni terrorist organization that has been known to target Shiite mosques.

In a social media post on Friday, Pakistani Defense Minister Khawaja Asif claimed the bomber “has been proven to have been coming and going from Afghanistan.” He also accused India of masterminding the attack.

“The threads of the alliance between India and the Taliban are being uncovered,” he said, without providing any evidence for his assertion.

“The state will respond to this oppression with full force,” he vowed.

Pakistani interior minister Tallal Chaudhry later clarified that the attacker was not an Afghan national, but had traveled recently to Afghanistan, according to unspecified forensic evidence.

“They are not carrying out attacks for religion, but for dollars,” Chaudhry asserted. “Whether they belong to the BLA, TTP, or any other group, they are paid in dollars.”

BLA is the Balochistan Liberation Army, a violent group of Baloch nationalists headquartered in the Balochistan regions of Pakistan and Afghanistan. TTP is Tehrik-i-Taliban Pakistan, also known as the “Pakistani Taliban,” a group devoted to overthrowing the civilian government in Islamabad and replacing it with an Islamic “caliphate” modeled on the Taliban regime in Afghanistan.

The Indian government condemned the suicide bombing on Friday, and blasted Pakistani officials for seeking to link the attack to India.

“It is unfortunate that, instead of seriously addressing the problems plaguing its social fabric, Pakistan should choose to delude itself by blaming others for its home-grown ills,” said India Foreign Ministry spokesman Randhir Jaiswal.

“India rejects any and every such allegation, which is baseless as it is pointless,” he said.

Condemnations of the attack poured in from across the Middle East and around the world, including the United States. U.S. Deputy Ambassador Natalie Baker offered “sincere condolences to those injured, and to the families and loved ones of those killed by this attack.”

“Acts of terror and violence against civilians and places of worship are unacceptable. The people of Pakistan deserve safety, dignity, and the ability to practice their faith without fear,” Baker said.