Yes, Afghanistan was where Taleban was which was giving shelter to OBL and his gang of terrorists called Al Qaeda who mastermided the 9/11 and several prior attacks.
The so called TTP is nothing but the formal incorporation of some of the terror groups nurtured by ISI to falseflag as mujahideen etc. After the WOT started, atleast the overt & official support of these terrorists had to be stopped due atleast partly to threats mounted by USA. Various parts of the military establishment including ISI and the Musharraf regime were at logger heads around how best to continue/not continue support. The terrorists started attacking Pakistani targets as a show of strength, prodded on by supporters inside teh establishment! But due to US pressure and watch, Pak army retaliated against this show of strength - kind of head eating the tail! Next thing you know all hell broke loose! remember neither ISI nor military is so unified - there are fractions