KABUL -- A suicide bomber struck a private education centre in a Shiite neighbourhood of Kabul on Wednesday where high school graduates were preparing for university entrance exams, killing 48 young men and women and leaving behind a scene of devastation and tragedy.

The bombing, blamed on the Islamic State group, was the latest assault on Afghanistan's Shiite community, which has increasingly been targeted by Sunni extremists who consider Shiites to be heretics.

It also showed how militants are still able to stage large-scale attacks, even in the heart of Kabul, and underscored the struggles of the Afghan forces to provide security and stability on their own.

The attack comes amid a particularly bloody week in Afghanistan that has seen Taliban attacks kill scores of Afghan troops and civilians.

It was not immediately clear how the bomber managed to sneak into the building, used by the Shiite community as an education centre, in the Dasht-i Barcha area of Kabul.

The spokesman for the public health ministry, Wahid Majroh, said 67 people were also wounded in the bombing and that the death toll -- which steadily rose in the immediate aftermath of the bombing -- could rise further. He did not say if all the victims were students and whether any of their teachers were also among the casualties.

Dawlat Hossain, father of 18-year-old student Fareba who had left her class just a few minutes before the bombing but was still inside the compound, was on his way to meet his daughter and started running when he heard the explosion.

Hossain recounted to The Associated Press how when he entered Fareba's classroom, he saw parts of human bodies all over student desks and benches.

"There was blood everywhere, all over the room, so scary and horrible," he said. After finding out that his daughter was safe, he helped move the wounded to hospitals.

Fareba was traumatized that so many of her friends were killed, but Hossain said she was lucky to be alive.

The explosion initially set off gunfire from Afghan guards in the area, leading to assumptions that there were more attackers involved, but officials later said all indications were that there was only one bomber.

No group immediately claimed responsibility for the attack but Jawad Ghawari, a member of the city's Shiite clerical council, blamed IS, which has carried similar attacks on Shiites in the past, hitting mosques, schools and cultural centres. In the past two years, there were at least 13 attacks on the Shiite community in Kabul alone, he said.

Afghan President Ashraf Ghani condemned the "terrorist" attack that "martyred and wounded the innocent" -- students attending class -- and ordered an investigation into the attack.

"By targeting educational and cultural centres, terrorists have clearly shown they are against all those Islamic principles (that strive) for both men and women to learn and study," Ghani said in a statement.

The head of the U.N. children's agency denounced the attack, saying it's "deplorable" that children continue to be hardest hit in the growing violence across Afghanistan.

"Children are not, and must never be the target of violence," said UNICEF's executive director Henrietta Fore.

Meanwhile, a Taliban assault on two adjacent checkpoints in northern Afghanistan late on Tuesday night killed at least 30 soldiers and policemen.

The attack took place in Baghlan province's Baghlan-I Markazi district, said Mohammad Safdar Mohseni, the head of the provincial council.

Dilawar Aymaq, a parliamentarian from Baghlan, said the attack targeted a military checkpoint and another manned by the so-called local police, militias recruited and paid by the Interior Ministry.

At least nine security forces were still missing and four others were wounded in the attack, said Abdul Hai Nemati, the governor of Baghlan. He said reinforcements have been dispatched to help recapture the checkpoints.

Taliban spokesman Zabihullah Mujahid claimed responsibility for the assault.

Life was gradually returning to normal Wednesday in parts of the eastern city of Ghazni after a massive, days-long Taliban attack, though sporadic gunbattles was still underway in some neighbourhoods.

The Taliban launched a co-ordinated offensive last Friday, overwhelming the city's defences and capturing several neighbourhoods. Afghan forces repelled the initial assault and in recent days have struggled to flush the insurgents out of residential areas where they are holed up.

The United States and NATO launched airstrikes and sent military advisers to aid Afghan forces as they fight for the city, just 120 kilometres (75 miles) from the Afghan capital with a population of some 270,000 people.

At least 35 Ghazni civilians have been killed, said Arif Noori, a spokesman for the provincial governor. The wounded were still arriving at the city's only hospital, which has been overwhelmed by casualties, he added.

Hundreds of people have fled the fighting in Ghazni, which has also killed about 100 members of the Afghan security forces.

Elsewhere in Afghanistan, the Taliban attacked a police checkpoint in the southern Zabul province early Wednesday, killing four policemen, according to the provincial police chief, Mustafa Mayar.

The Taliban have seized several districts across the country in recent years and carry out near-daily attacks targeting Afghan security forces. The assault on Ghazni was widely seen as a show of force ahead of possible peace talks with the U.S., which has been at war in Afghanistan for nearly 17 years.

Also Wednesday, six children were killed when they tinkered with an unexploded rocket shell, causing it to blow up, said Sarhadi Zwak, spokesman for the governor of the eastern Laghman province. The victims were girls, aged 10-12, who were gathering firewood, he said, blaming the Taliban.

Afghanistan is littered with unexploded ordnance left by decades of war. It is also plagued by roadside bombs planted by insurgents, which are usually intended for government officials or security forces, but often kill and maim civilians.

------

Associated Press writer Edith M. Lederer at the United Nations contributed to this report.