More than 31 people have been killed in a militant attack on a checkpoint in the volatile north-western region of Pakistan.

According to officials, at least 12 militants and nine security personnel have been killed so far in the attack. The casualties are said to include civilians.

The militant attack has come a day after a suicide explosion ripped through a mosque in Peshawar killing nearly 23 people. The sectarian attack on the Shiite muslim mosque is believed to have been carried out by the Taliban.

The latest assault on the checkpoint took place on an army camp in Serai Naurang town in Khyber Pakhtunkhwa province.

Heavily armed militants stormed the checkpoint with automatic weapons and rocket-propelled grenades. Nearly 40 militants were said to have been involved in the raid which took place in the early hours.

Some of the militants, who included suicide bombers, were killed by Pakistani security forces before they could trigger their devices. Sounds of explosion and gunfire were heard in the region for a brief while, said local reports.

The Pakistan Taliban has claimed responsibility for the attack. The Islamic militant group said the assault was retaliation for US drone strikes in the North Waziristan region, considered to be a safe haven for al-Qaida and Taliban militants.

"Pakistan has been co-operating with the US in its drone strikes that killed our two senior commanders, Faisal Khan and Toofani, and the attack on military camp was the revenge of their killing," said a Taliban spokesperson, according to Reuters.