When the US started bombing Tora Bora and began its operation in Torkham, it was meant to corner the al Qaeda and the Talibans that were hiding them.
But you know what happened - They fled to Pakistan. Every time the NATO forces went after the terrorists, they were stopped at the border by the Pakistani forces. But the insurgents had a free run to go hide in Pakistan.
US was time and again asked to apologize for clashing with the forces on border - otherwise, the supplies would be blocked.
So the US focused on cleaning its own area, and didn't give a sh!t about where they went.
In Pakistan, these same terrorists (equipped with intellect of al Qaeda), and a bunch of others (small factions) from entire Pakhtunkhwa consolidated themselves and staged regular attacks on the NATO supplies to fill their arsenal.
So many in Pakistan often celebrated each time the NATO supplies got attacked/looted.
But the problem is, NATO has a strong base in Jalalabad - right across the border, to stop them from getting into Afghanistan. That is why the terrorists find it easier to blow Charsadda, Mardan, Jamrud, Peshawar etc, than to go to Jalalabad or to Kabul.
So, when you say they came from Afghanistan, yes they did, but they were deliberately not stopped. By whom... we all know.