Local newspaper reports said four of the terrorists have also been gunned down as they fought security forces.
Thirteen people were injured in the Pakistani city of Peshawar on Friday when terrorists stormed an agricultural training centre and opened fire in an attack claimed by the Tehreek-e-Taliban Pakistan (TTP). At least 37 people were injured in total, sources said.
Pakistan media Geo news reported that three attackers, with their faces covered, entered the Directorate, located next to the University of Agriculture, and started firing. "I got up and within seconds everybody was running and shouting 'the Taliban have attacked, '" said a student. The area reverberated with heavy gunfire while a huge explosion was also heard.
The area where the incident occurred is a hub for educational institutions in the city including the University of Peshawar.
The hostel of the directorate was officially closed on Friday as the country observes Eid Miladun Nabi.
"We have received six dead bodies and 18 injured, two of them are in critical condition", a spokeswoman for the Hayatabad Medical Complex, Ishrat Bibi, told AFP.
Pakistani security officials inspect the scene of the attack.
"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.
The compound includes a hostel facility for diploma students and there were around 50 students there at the time of attack, police said.
An operation between forces and the suspects, under the supervision of Peshawar Capital City Police Officer Tahir Khan, was launched. In 2014, Pakistani Taliban gunmen murdered more than 140 children in Peshawar, according to the BBC, making it one of the deadliest attack in the country's history.