At least seven students were killed and scores more wounded Tuesday in a bomb attack on a Koran study class at a religious school in northwestern Pakistan, officials said.

More than 60 people had been taking a lesson when the explosion tore through the madrassa in Peshawar, about 170 kilometres (around 100 miles) west of Islamabad, said Waqar Azim, a senior police official.

"The blast took place in a seminary during a Koran class. Someone took a bag inside the seminary," Azim told AFP.

A rescue worker examines the scene of the blast at a religious school in Peshawar A rescue worker examines the scene of the blast at a religious school in Peshawar Photo: AFP / Abdul MAJEED

He added that the person who had brought in the bag left the lecture hall before the blast at the Jamia Zuberia seminary.

Mohammad Ali Gandapur, another senior police official, said at least seven people had been killed with more than 50 wounded.

The death toll was confirmed by Mohammad Asim Khan, a spokesman at a local hospital, who told AFP that seven bodies and 70 wounded people had been taken to the facility.

Map of Pakistan locating Peshawar where at least four students were killed and dozens wounded when a bomb exploded during a class at their religious school on Tuesday. Map of Pakistan locating Peshawar where at least four students were killed and dozens wounded when a bomb exploded during a class at their religious school on Tuesday. Photo: AFP / STAFF

"Most of those killed and injured were hit by ball bearings and some were badly burnt," he said.

All of the dead were men aged between 20 and 40, he said. Teachers and boys as young as seven were among the wounded.

Kamran Bangash, a spokesman for the government of Khyber Pakhtunkhwa province, put the death toll at eight and said about 10 students remained in critical condition.

Students killed in deadly attack on Pakistan religious school Students killed in deadly attack on Pakistan religious school Photo: AFPTV / Ahmad KHAN

Teacher Safiullah Khan told AFP more than 1,000 students are currently enrolled at the religious school, which is divided into two sections -- one for students aged 18 and older and the other for children.

"The blast took place in the section where students above the age of 18 were taking a class," Khan said, adding that the wall between the two sections collapsed in the blast.

A live stream of the lesson showed a religious teacher speaking in Pashto and Arabic, explaining a saying from the Prophet Mohammed, when the explosion took place.

Security personnel secured the street after the blast Security personnel secured the street after the blast Photo: AFP / Abdul MAJEED

Shortly afterwards, rescue workers and locals were seen scouring the site and collecting students' books, caps and shoes.

In a tweet, Prime Minister Imran Khan offered his condolences.

"I want to assure my nation we will ensure the terrorists responsible for this cowardly barbaric attack are brought to justice asap," Khan wrote.

The loud blast, which could be heard across most parts of Peshawar, wrecked the school's interior and damaged the roof of the main hall.

It was not immediately known why the madrassa was targeted and no group claimed responsibility for the attack, which followed months of relative calm in Pakistan.

Peshawar was once the epicentre of militant violence in the country, with jihadists targeting security forces and public spaces in the city near the northwestern frontier with Afghanistan.

Violence in Pakistan has declined in recent years following a series of military operations along the border, but militant groups are still able to carry out deadly attacks.

The operation was intensified after the Pakistani Taliban killed more than 150 people, the majority of them children, at a school in Peshawar in December 2014.

Still, the Pakistani Taliban have been regrouping in recent months with several factions coming together in a pact, raising fears the jihadists may be regaining strength after launching a string of small-scale attacks on security forces along the border.