The blast was a heavy blow for the Pakistani military which has been fighting a stubborn insurgency in the country's northwest. Bombs and shootings have killed thousands of security forces 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. He spoke on condition of anonymity because he was not authorized to speak to the media.

The explosion killed 20 security personnel and wounded another 30, the Pakistani military said in a statement.

A spokesman for the Pakistani Taliban, Shahidullah Shahid, said in a telephone call to The Associated Press that the attack had been carried out to avenge the death of the group's former number 2, 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.

The explosion was heard and felt across the town of Bannu.

On resident who lives close to the military cantonment said he heard a deafening explosion, and his house shook.

"I rushed out of my home and saw black thick smoke billowing out of the cantonment's Razmak gate area," said Sajjad Khan. He said troops quickly cordoned off the area and ordered residents to go back inside their homes.

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. But blasts inside a compound are rare.

Pakistani defense analyst Zahid Hussain said while the army has its own transport vehicles, the paramilitary forces often hire vehicles when they need to move troops in large numbers like Sunday's convoy. Neither the Pakistani army nor the paramilitary troops have armored vehicles for troop transports, Hussain said.

It's not clear how or when the explosive was planted on the vehicle, but Hussain said the use of private vehicles would make it much easier to plant such a device.

The Pakistani military has been fighting for years against militants in the tribal areas who want to overthrow the government and establish a hard-line Islamic state across Pakistan. The militants view the army and other military forces as carrying out an American agenda in the tribal areas, which border Afghanistan and are also seen as a refuge for insurgents in that country.

But many Pakistanis resent fighting fellow Muslims and have tired of the long war. Many see it as having been foisted upon them by the U.S. after the Sept. 11 attacks and the invasion of Afghanistan.

Prime Minister Nawaz Sharif was elected last May in part by promising to end the fighting through a negotiated settlement instead of through military operations. But so far the Pakistani Taliban has shown little desire to negotiate with the government.

The militant group ruled out peace talks with the government after an American drone killed the group's leader Hakimullah Mehsud on Nov. 1, although even before that many analysts had little faith the negotiations would be successful. Previous peace talks have quickly fallen apart, and many analysts say such negotiations are generally used by the militants to regroup for future fighting.

The militants accused Pakistan of helping the U.S. target Mehsud. Islamabad vehemently denied the allegation and accused Washington of sabotaging its attempt to strike a deal with the Taliban to end years of violence.

The militant group vowed to step up its attacks against the government and the military, and Mehsud's replacement, Mullah Fazlullah, is not seen as a supporter of peace talks.

Fazlullah was the leader of the Pakistani Taliban in the northwest Swat Valley and fled to Afghanistan after the army launched an offensive there in 2009. He is known as a particularly ruthless militant who planned the attempted assassination of teenage activist Malala Yousafzai in 2012.

Recently, Pakistan has seen an uptick in attacks claimed by the Pakistani Taliban. A senior police official responsible for hunting militants in the port city of Karachi was killed Jan. 9 in a bombing, and gunmen shot and killed three employees of a media channel in the same city on Friday.