Gunmen have attacked a university in northwestern Pakistan, leaving at least three people hurt, and are still on the rampage, security and school officials told AFP Wednesday in the latest assault to hit the militant-infested region.

Security forces have reached the Bacha Khan university in Charsadda, about 50 kilometres (30 miles) from the city of Peshawar, the military confirmed, as police said they had deployed armoured vehicles.

Television images showed female students clutching hands as they fled the university, with traffic blocked on the roads of Charsadda as security forces rushed towards the campus.

"There is firing inside the university at Charsadda," Saeed Wazir, a senior police official, told AFP.

The university has been cordoned off, said Nasir Durrani, police chief of Khyber Pakhtunkhwa province, of which Peshawar is the capital.

Fazal Raheem Marwat, the university vice chancellor, said at least three people had received unspecified injuries.

"There are male and female staff members and students on the campus," he said, adding he had been on his way to work when he was informed of the attack.

"There was no announced threat but we had already beefed up security at the university."

The gunmen had stormed the campus on its southern side, he said.

Nick Mohammed, security chief at the university, said the attackers had entered close to a campus guest house.

He confirmed that police and military had arrived with firing continuing on campus, and that at least three people have been hurt so far.

Peshawar was the location of Pakistan's deadliest ever extremist attack, when Taliban gunmen stormed an army-run school in December last year and killed more than 150 people, most of them children, in an hours-long siege.

READ: Pakistan hangs four convicted of Taliban massacre at school

The attack on the school prompted a crackdown on extremism in Pakistan, with the military increasing an offensive against militants in the tribal areas where they had previously operated with impunity.

All nine attackers were killed in the siege on Peshawar's Army Public School, which killed 151 people in total on Dec. 16, 2014. It was the worst Taliban attack on Pakistani soil.

On Tuesday, a suicide attack at a market on the city's outskirts killed 10 people as well as the bomber.