The Pakistani army said Saturday the four gunmen who attacked a university in northwest Pakistan were trained in Afghanistan and the assault was controlled by a Pakistani Taliban militant from inside Afghanistan.

In a briefing to reporters from the city of Peshawar, military spokesman Gen. Asim Bajwa said the militants who stormed Bacha Khan University in Charsadda Wednesday, killing at least 20 people, received training in Afghanistan and crossed over into Pakistan from the Torkham border between the two countries.

Bajwa said the attack was masterminded by Umar Mansoor, a Pakistani Taliban militant based in Afghanistan who also is held responsible for the December 2014 massacre of 134 children in the city of Peshawar — the deadliest militant attack in Pakistan's history.

A deputy of Mansoor helped the attackers reach the Torkham border from where they crossed over into Pakistan, the spokesman said.

The army's claims once more highlight the need for improved relations between Afghanistan and Pakistan which would prevent militants from carrying out cross-border terror attacks that have undermined peace efforts in the region.

Pakistani officials say the Pakistan Taliban chief known as Mullah Fazlullah has been orchestrating raids on Pakistan from Afghanistan where he fled several years ago after a Pakistani army offensive against his stronghold in the Swat Valley.

Afghan officials see Pakistan's suggestion that Afghans are supporting cross-border attacks as an attempt to distract attention from what they say is Pakistan's long history of supporting Afghanistan's Taliban movement and other insurgent factions.

"The attackers were prepared in Afghanistan," army spokesman Bajwa said. "We have come to the conclusion that terrorism cannot be fought when there are accomplices and facilitators."

Providing details of the planning of the attack, the military spokesman said the gunmen used public transportation from the Afghan border to reach Mardan city, about 30 kilometers from Charsadda, where they were received by four Pakistani men, now in army custody.

"After entering Mardan, the terrorists were received by Adil and Riaz," Bajwa said, identifying two of the suspected accomplices who he said put up the militants in two houses in Mardan.

"Adil is a laborer and just a few days ago he did some masonry work in the university, and made a map of the university which he shared with the militants," said the military spokesman.

"Adil is the one who helped the attackers carry out reconnaissance of the area around the university."

Another accomplice, identified as Noorullah, bought an auto-rickshaw and transported the attackers from Mardan to the sugarcane fields next to Bacha Khan University, which they crossed through to finally scale the walls of the campus and carry out the assault.

Umar Mansoor, the mastermind identified by the Pakistan military, Friday released video footage of the fighters he said carried out Wednesday's deadly assault and vowed more attacks on schools and universities.

Pakistan has killed and arrested hundreds of suspected militants under a major crackdown launched after the December 2014 school attack, which is seen as having hardened Pakistan's resolve to fight militants along its border with Afghanistan.