Updated

A Taliban suicide bomber blew himself up near Pakistan's main military headquarters on Monday, killing 13 people just a day after the militants struck inside an army compound in the northwest of the country killing 20 troops, officials and militants said.

The two-day barrage is among the most intense onslaughts recently against the Pakistani army as it struggles to battle insurgents in the country's volatile frontier regions.

Monday's attack took place early in the morning in the garrison city of Rawalpindi, next to the capital of Islamabad. Police official Sardar Zulfiqar said a suicide bomber struck just outside the main military headquarters.

A retired officer and five soldiers were among those killed, according to police officer Haroon Joiya, who said the bombing also wounded 18 people.

The suicide bomber was riding a bicycle and detonated his explosives when he got close to a military checkpoint, said Joiya.

Sunday's bombing in the northwest targeted a vehicle in a convoy that was about to leave a military base in the town of Bannu and drive west to the North Waziristan tribal area, police official Inyat Ali Khan said. Pakistan's military said that attack also wounded 30 troops.

The Taliban had also claimed responsibility for Sunday's attack and called it a suicide bombing. Military officials said the blast came from an explosive planted in the vehicle, hired by the paramilitary Frontier Corps. While the army has its own transport vehicles, the paramilitary forces often hire vehicles when they need to move troops in large numbers.

A spokesman for the Pakistani Taliban, Shahidullah Shahid, told The Associated Press by telephone that the attack had been carried out to avenge the death of Waliur Rehman, the group's former second in command. He was killed last year in a U.S. drone strike.

"We will avenge the killing of every one of our fellows through such attacks," the spokesman warned.

Shahid also claimed responsibility for the Rawalpindi blast, saying in another telephone call on Monday that the army was the target.

North Waziristan is considered a safe haven for al-Qaida-linked militants and Pakistani troop convoys in the region are often hit by roadside bombs, though attacks inside military compounds are rare.

Last December, a suicide bomber killed four Pakistani soldiers when he rammed an explosive-laden car into a checkpoint outside an army camp in North Waziristan. And last April, 30 Pakistani troops died over a four-day period in another part of the northwest called the Tirah Valley as part of an operation to oust militants hiding there.

The Pakistani military has been fighting for years in the tribal areas against militants who want to overthrow the government and establish a hard-line Islamic state. The tribal region is also a refuge for insurgents fighting NATO and U.S. forces in neighboring Afghanistan.

Prime Minister Nawaz Sharif, elected last May, has promised to end the fighting through peace talks. But so far the Pakistani Taliban have shown little desire to negotiate with the government and ruled out talks after a U.S. drone strike killed leader Hakimullah Mehsud on Nov. 1. Previous attempts at talks quickly failed.

Mehsud's replacement, Mullah Fazlullah, is not seen as a supporter of peace talks. Fazlullah is known as a particularly ruthless militant who planned the failed assassination targeting teenage activist Malala Yousafzai in 2012.

But in their statement on Sunday, the Taliban said they would be open to talks with the government -- but only if the government proved it was sincere and had enough "power," a reference to the perception that the army wields the real power in Pakistan.

Sharif, the prime minister, is chairing a cabinet meeting later Monday to discuss country's counter terrorism policy.