A bomb planted by the Taliban has ripped through a vehicle carrying security forces inside a Pakistani army compound in the country's volatile north-western region, killing 20 troops.
The blast is a major setback for the Pakistani military, which has been fighting a stubborn insurgency in the country's north-west.
Bombings and shootings have killed thousands of security forces personnel and left thousands more wounded and maimed.
The vehicle was hired by the paramilitary Frontier Corps, said police official Inyat Ali Khan from the Bannu region where the explosion occurred.
It was part of a convoy that was about to leave the military base in the town of Bannu and drive west to the North Waziristan tribal area, he said.
The convoy was part of a regular Sunday morning troop rotation going into North Waziristan, said a military source. He said the bulk of the casualties were from the Frontier Corps because the bomb was planted in a vehicle hired by the paramilitary force to transport their personnel.
The explosion killed 20 security personnel and wounded another 30, the Pakistani military confirmed.
A spokesman for the Pakistani Taliban, Shahidullah Shahid, said the attack had been carried out to avenge the death of the group's former second-in-command, Waliur Rehman. He was killed last year in an American drone strike.
"We will avenge the killing of every one of our fellows through such attacks," the spokesman warned.
North Waziristan is considered a safe haven for al-Qaida linked militants. Pakistani troop convoys often are hit by roadside bombs.
Last December, four Pakistani troops were killed when a suicide bomber rammed an explosive-laden car into a checkpoint outside an army camp in North Waziristan. However, blasts inside a compound are rare.