A suicide bombing outside district court buildings in the Pakistani capital Islamabad killed at least 12 people and wounded 27 yesterday, the interior minister said.

The first such attack to hit the city in years sent people fleeing in panic in an area which also houses several government offices. "A suicide attack was carried out," Interior Minister Mohsin Naqvi told journalists. "So far 12 people have been martyred and around 27 are wounded."

An AFP journalist saw paramilitary troops cordoning off the area where the minister said the assailant detonated the explosives near a police vehicle.

"We are trying to identify who he (the attacker) is and where he came from," Naqvi said. Pakistani Taliban militant group claimed responsibility, saying in a statement they had targeted judicial officials.

"Our fighter attacked the judical commission in Islamabad. Judges, lawyers and officials who carried out rulings under Pakistan's un-Islamic laws were targeted," the group said in a statement, threatening to carry out more attacks "until Islamic Sharia law is implemented" in the Muslim-majority country.

Earlier, Prime Minister Shehbaz Sharif pinned the blame on "terrorist proxies backed by India", Pakistan's longtime foe, without providing evidence.

Sharif accused the Pakistani Taliban militant group and separatists from the country's Balochistan region, both of whom have carried out attacks mostly targeting the security forces.

In Islamabad, lawyer Mohammed Shahzad Butt said there was a "massive blast".

"Everyone started running inside out of panic. I have seen at least five dead bodies lying at the front gate," he told AFP.

Rustam Malik, another lawyer, told AFP he "heard a loud bang at the gate" as he was entering the complex.

"It was complete chaos, lawyers and people were running inside the complex. I saw two dead bodies lying on the gate and several cars were on fire," said Malik.

Islamabad has largely been spared major militant violence in recent years, with the last suicide attack occurring in December 2022.

The bombing came as Pakistani security forces battled militants who had holed up in a school in northwest Khyber Pakhtunkhwa's Wana district.

"There was an attack in Wana as well last night," Naqvi said. "Three people died in that attack. The attacker involved in that attack is an Afghan. Afghanistan is directly involved in that attack."