Nine people were killed and dozens injured Friday when burqa-clad Taliban militants stormed a training institute in the northwestern city of Peshawar as Pakistan marked the birthday of the Prophet Mohammed, officials said.
Police said at least three militants opened fire at security guards near the gates of the Agriculture Training Institute, injuring one of them before making their way inside and targeting the student accommodation.
Authorities said the gunmen had been killed and security forces had cleared the area after searching for remaining militants.
"All of them were wearing suicide vests but they were killed before they could blow themselves up," said Salahuddin Khan Mehsud, police chief of Khyber Pakhtunkhwa province.
The police chief said six students, a security guard and two civilians were killed in the attack.
"All three terrorists are dead while we are trying to identify a fourth body," he added, following earlier reports there had been an additional gunmen.
A spokeswomen for two hospitals in the city said they had received a total of nine bodies and were treating some 38 injured, including several in critical condition.
During the onslaught on the training centre, a spokesman for the Tehreek-e-Taliban Pakistan, Muhammad Khurasani, claimed responsibility for the attack in a telephone call to AFP.
"Our mujahids have attacked the building because it was used as office for ISI, God willing our fighters will fight till the last drop of blood," he said, referring to Pakistan's Inter Services Intelligence agency.
Noor Wali, a 19-year-old student at the institute, described a terrifying ordeal that began when he was woken by gunshots.
"I rushed to the door and saw a fountain of blood pumping out of the shoulder of my roommate who was standing outside the room," he told AFP.
He and another student rushed to his aid, and hid from the gunmen for almost an hour before they were rescued by security forces.
"The other student was pressing the wound with his hands to stop the blood and I had to put my hand on his mouth so that he cannot scream," he said.
"We took shelter inside the bedroom and were begging the injured student not to make any sound as the terrorists might hear it and kill us."
The area where the incident occurred is a hub for educational institutions in the city including the University of Peshawar.
An interior ministry official told AFP that cellular networks had been suspended in various cities across the country for security reasons.
The attack also bore striking similarities to a 2014 Taliban massacre at the army-run school in Peshawar that killed 151 people, mostly schoolchildren.
The incident comes amid tight security across Pakistan as it celebrates the birthday of the Prophet Mohammed.
The country is tense after weeks-long anti-blasphemy protests in Islamabad that saw seven killed and hundreds wounded in clashes with police.
Violence erupted over the weekend after police and paramilitary forces launched a bungled attempt to clear the sit-in, igniting fresh demonstrations in cities across the country, including in Lahore and Karachi.
The protests finally ended just days ago under a military-brokered deal.