The four terrorists who stormed into the Bacha Khan University in Pakistan on Wednesday and killed 21 people were talking to individuals in Afghanistan even while the attack was underway, the Pakistani Army said. 

The Pakistan Taliban -- Tehreek-e-Taliban -- which had initially claimed the attack, later denied that it was involved. 

Two cell phones were recovered from the terrorists and their call logs were analysed, Pakistan Army spokesperson Asim Bajwa said at a press conference on Wednesday, according to Dawn

"The attackers were in touch with a number from Afghanistan," The Express Tribune quoted him as saying. 

Bajwa also added that the SIM cards used in the phones were from Afghanistan. 

The four attackers were alive when the Pakistani Army forces reached the Bacha Khan University after gunfire and explosions were reported. 

"When the army reached the premises, all four attackers were alive. They were contained in the hostel and were eventually eliminated on the roof and the stairs," the army spokesperson said. 

Twenty one people, including at least one professor, several students and some security guards, were killed in the attack that was reminiscent of the December 2014 Peshawar school massacre. 

Tehreek-e-Taliban spokesperson Mohammad Khurrassani called the Bacha Khan university attack "unIslamic".