PESHAWAR, Pakistan (Reuters) - A Taliban suicide bomber killed at least three people and wounded dozens on Tuesday in northwest Pakistan where security forces are fighting the Islamist militants, officials said.

The attack targeted a paramilitary vehicle outside a government compound in the Jamrud area of the Khyber region, official Shaukatullah Afridi, who was meters away from the blast, told Reuters.

"I had just entered the office and sat on my chair when I heard a huge blast," Afridi said.

"It seemed as if the whole building had collapsed."

Afridi's office is on the road leading from the city of Peshawar, through the Khyber Pass, to the Afghan border.

At least 43 wounded people were taken to hospital in Peshawar, about 20 km (12 miles) to the east, hospital doctor Noor Wazir said, adding the death toll could rise.

The Pakistani Taliban are allied with the Afghan Taliban and fighting Pakistani government forces in the hope of establishing strict Islamist rule.

The militants claimed responsibility. Spokesman Mohammad Khorasani said in a telephone call to Reuters the attack was revenge for government operations against them.

The military has been battling the Pakistani Taliban and an allied faction, the Lashkar-e-Islam, in Khyber since October last year, with fighting mostly focused on the strategic Tirah Valley, near the Afghan border.

Hundreds of militants have been killed in ground fighting and air strikes, according to the military. Some soldiers have also been killed.

Reuters has been unable to independently verify casualty figures as access to the area has been strictly controlled.

Hundreds of militants are said to have taken refuge in Khyber after fleeing a military offensive against their stronghold of North Waziristan, along the Afghan border to the south, that began in June last year.

At their height, the Pakistani Taliban controlled swathes of territory in the northwest but they have been beaten back by repeated military operations since 2009.

They now operate in smaller pockets in ethnic Pashtun areas near the Afghan border, from where they launch bombings and other attacks on Pakistani forces and other targets.