Local residents and officials have expressed anger and grief after unidentified gunmen entered the Bacha Khan University in northwest Pakistan and opened fire on students and teachers, killing 20 people and wounding at least 50 others.

Fakhar-e-Alam, 37, a cook at a school hostel, was one of those killed in Wednesday's attack on the university complex in Charsadda, in Khyber-Pakhtunkhwa province.

Speaking to Al Jazeera hours later, Shah Hussain remembered what his his son had told him before leaving for work earlier that morning.

"He told me: 'I have guests coming today and I must get to work as soon as possible. It is my responsibility to take care of them'," said Hussain.

"When the gunmen attacked the hostel, he took his guests to a room and locked the door behind them in an attempt to hide them from the terrorists.

"Once he did that, he ran to close the gate where he was shot dead by a gunman.

Pakistan army says deadly university attack over

"My son would always make sure to take care of his guests. This was a matter of pride for him and, look, he even died protecting his guests."

The university, named after the founder of an anti-Taliban Awami National Party and a Pashtun activist, Abdul Ghaffar "Bacha" Khan, was hosting 600 visitors for a poetry recital on the anniversary of the founder's death.

"The university was always under threat because of its association with the Awami National Party and Bacha Khan. The [Pakistani] Taliban staged minor attacks at the university in the past as well," said Zaheer Iqbal, former assistant director of planning and development at Bacha Khan University.

"Security has always been poor at the university. It was, without doubt, an easy target for the terrorists.

"I knew my life was in danger at the time of my employment at the university, I was unsure every morning whether I would come back home alive, which is why I quit my job."

The mastermind of the deadly 2014 attack on the Peshawar Army Public School, Umar Mansoor, from the Pakistani Taliban, initially claimed responsibility for the attack in a Facebook post on Wednesday.

But the claim was later denied by the the group's spokesman, Mohammad Khorasani, who condemned the the attack in a statement, calling it "against Sharia".

'Take matters in hand'

Witnesses to Wednesday's attack described horrific scenes of violence, but also recalled attempts by staff and students to fight back against the gunmen.

Among those who tried to counter the attack was Hamid Hussain, 37, an assistant professor who taught organic chemistry at the university,

Students say that he was shot dead as he tried to shoot back at the attackers.

"I saw him pulling out his pistol and running towards the scene. He fired at the militants, but was immediately shot dead," a student, Saad Shafqat, told Al Jazeera.

"We will all do the same. He left a message behind for us before dying. If the government [and] security officers cannot provide us with security, we will take matters in our own hands."

Hussain leaves behind a wife and two children.

"My sister is [devastated] after hearing about the death of her husband. The entire town is in tears, we are all mourning. Something needs to be done. We can't keep losing our loved ones," said Naseem Akhbar, Hussain's brother-in-law.

"He will be remembered for his bravery. He took the bullets in an attempt to save his colleagues and students."

A district official, who wished to remain anonymous because he was not authorised to speak to the media, told Al Jazeera that residents of the district carry guns for their safety "as the security situation is getting worse by the day".

"I don't blame them, why wouldn't they carry guns if attacks like these happen every now and then? We've been asking for a security team in the district and security checks for a very long time now, but nothing so far," he said.

"This university was under threat for a very long time, everyone knew. Even the intelligence team received a warning about this attack, but no action was taken.

"Many people were ready to leave their homes and use their own weapon to fight the terrorists in the university, including me."

#Bloodandtearsonly

Many expressed their anger and grief at the Pakistan government through a Twitter hashtag #Bloodandtearsonly as the university attack brought back grim memories of the 2014 Peshawar school attack which killed more than 150 people, mostly children.

? "# BloodAndTearsOnly ? Dear leaders This nation wants solution to this bloodshed of u cant provide the same then u have no right to rule," wrote a Twitter user, @Mashal1144 .

Pakistan observes a day of mourning amid the attack and candlelight vigils were held for the victims in Peshawar and elsewhere in Pakistan.

Follow Shereena Qazi on Twitter: @ShereenaQazi