Image copyright AFP Image caption Nearly 30 people were also injured in the attack, including children

At least 14 people have been killed in a Pakistan bombing which militants say was in revenge for the execution of a policeman turned assassin.

The suicide attack, at the entrance to a court in the north-western town of Shabqadar, wounded nearly 30 others, police told local media.

Militants said it was to avenge the hanging last week of Mumtaz Qadri, who was seen by many as a religious hero.

Qadri killed the governor of Punjab in 2011 for opposing blasphemy laws.

Shabqadar is located on the border of the tribal district of Mohmand, which remains volatile years after the military said it had been cleared of militants.

"The court and judges were our target as their practices are un-Islamic," a spokesperson for Jamaat-ul-Ahrar, a splinter group of Tehrik-e Taliban Pakistan (TTP), told Pakistan's Express Tribune.

Why did Pakistan keep hard-line mourners off air?

How Punjab governor's killer became a hero

Analysis: M Ilyas Khan, BBC News, Islamabad

The attack in Shabqadar is the first response by Taliban militants to last week's execution of Mumtaz Qadri, a former police guard who had shot dead a provincial governor for alleged blasphemy. It took place in the same region where a similar attack on a university campus in January left more than 20 people dead.

This region in north-western Pakistan is located on the border with Pakistan's semi-autonomous Mohmand tribal district, which adjoins the Afghan province of Kunar.

In the past, the area has been home to the so-called Mohmand Taliban, a regional ally of Tehrik-e Taliban Pakistan (TTP). But most of its sanctuaries were eliminated by the military in a series of operations during 2011-12.

However, the Mohmand Taliban slipped into neighbouring Kunar, from where they have continued to be able to launch attacks inside Pakistan.

Pakistani officials have been raising the issue with the Afghan authorities, but many analysts suggest Kabul doesn't have the resources to establish its authority in the remote mountainous region.