The Taliban claimed the most deadly of the two assaults, a coordinated attack on police in the southeast Afghan city of Gardez that left hospital officials calling for blood donations and desperate scenes as relatives queued for news of their loved ones after the hours-long gun battle.
A separate ambush blamed on the Taliban in the neighbouring province of Ghazni on Tuesday killed 15 security officials with 12 wounded on a bloody day for government forces.
The assaults are a fresh blow as militants step up their offensives across Afghanistan, with security forces already beset by corruption, desertions and suffering shocking casualties over the past year.
"The hospital is overwhelmed and we call on people to donate blood," said Shir Mohammad Karimi, deputy health director in Gardez.
Doctors and nurses rushed to attend to the wounded women, children and police filling the corridors where some bodies also lay. Outside, university students formed a queue to donate blood, an AFP photographer said.
The attack, claimed by the Taliban in a tweet, began when two suicide car bombs blew up near the training centre, which is close to the Paktia police headquarters, making way for the gunmen to start their assault, the interior ministry and local police said.
"Most of the victims are civilians who had come to the police headquarters to get their passports and national IDs," according to a statement from the Paktia governor's office.
A student at a nearby university who was in class at the time of the attack said he heard "a big boom" which caused the building to shake and windows shatter.
"As we were trying to find our way (out of the building) I heard a second blast and then the dust and dirt covered us in the class. Several of my classmates were wounded by broken glass," Noor Ahmad told AFP.
The battle between the attackers, armed with guns and suicide vests, and security forces lasted around five hours before it ended with all five militants killed, officials said.
Photos posted on Twitter showed two large plumes of smoke rising above the city.
The second attack, in Ghazni some 100 kilometres (62 miles) from Gardez, involved insurgents detonating an explosives-laden Humvee vehicle near a police headquarters and attackers storming the building, Haref Noori, the Ghazni governor's spokesman, told AFP.
"Dozens of Taliban" were killed in the attack, Ghazni police chief Mohammad Zaman said.
The attacks are the latest in a series of assaults by militants targeting Afghan security installations, including one on a military hospital in Kabul in March which may have killed up to 100 people, and a devastating attack on a base in Mazar-i-Sharif which left 144 people dead.
They came one day after four-way talks between Afghanistan, Pakistan, the United States and China were held Monday in Oman with the aim of ending the Taliban's 16-year insurgency.
Paktia province borders Pakistan's militancy-plagued tribal areas where the Taliban-affiliated Haqqani network has a presence.
Tuesday's attack in Gardez came hours after a US drone strike in Pakistan's Kurram tribal district, part of which borders Paktia, killed at least 26 Haqqani militants, officials have said.
Local officials told AFP that drones were still flying above Kurram after the attack, the deadliest targeting militants in the Pakistani tribal region this year.
In Kurram last week the Pakistani military rescued a US-Canadian family who had been abducted by militants in Afghanistan in 2012. US President Donald Trump has said they were being held by the Haqqani network.
The extremist group has been blamed for carrying out spectacular attacks across Afghanistan since the US-led invasion in 2001 and is known for its frequent use of suicide bombers.
It was blamed for the truck bomb deep in the heart of the Afghan capital Kabul in May that killed around 150 people.
The Haqqanis have also been accused of assassinating top Afghan officials and holding kidnapped Westerners for ransom.
These include the recently rescued hostages Canadian Joshua Boyle, his American wife Caitlan Coleman, and their three children, all born in captivity, as well as US soldier Bowe Bergdahl, who was released in 2014.
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)