Police chief Salahuddin Mahsud of Khyber Pakhtunkhwa province says attackers opened fire on the main gate of a provincial Agricultural Department complex, wounding two guards and two students.
Mahsud said three attackers clad in women's burqas then reached the gate in a rickshaw and opened fire to clear their way to the building. Seven others were wounded in the ensuing firefight.
The military isaid "all three terrorists" who holed up in a building in the complex, which houses offices, a teaching institute and a hostel. Army and police officials said 17, including four security men, a reporter and six students, were wounded.
Citing police and hospital officials, Reuters said at least nine people were killed and 35 wounded.
Mahsud added that dozens of people were rescued.