The operation in Swat was a followup of the events of the havoc caused by Lal Masjid witnessed in Islamabad, both were Takfiris. These people are also showing the signs of the people reffered to as Kharijis in the sayings of Prophet Mohammad SAW, some of the sayings warning the Muslim ummah regarding the Kharijis are:
The Prophet [Peace be upon him]: said,
* On the authority of Abu Sa`id al-Khudri: "Verily in the wake of this time of mine comes a people who will recite Qur'an but it will not go past their throats. They will pass through religion the way an arrow passes through its quarry. They will kill the Muslims and leave the idolaters alone. If I saw them, verily I would kill them the way the tribe of `Aad was killed [i.e. all of them]."
* "A people will come out at the end of times, immature, foolish and corrupt. They will hold the discourse of the best of creation and recite Qur'an, but it will not go past their throats. They will passes through religion the way an arrow passes through its quarry. If you find them, kill them, for verily whoever kills them will have his reward from Allah the Day of Judgment."
* "There will be towards the end of time a people who will say to you what neither you nor your forebears ever heard before. Beware of them lest they misguide you and bring you confusion."
* "They will pass through Islam like an arrow passes through its quarry. Wherever you meet them, kill them!"
* Hazrat Ali(Radiallhu Anhu) narrated as follows: "I heard the Holy Prophet (Sallal Laahu Alaihi Wasallam) as saying that as the Day of Qiyamah approaches there will appear a group of youths with a low mental capacity and understanding, apparently they will talk of good but their Imaan will not go beyond their throat and they will leave the true Deen like an arrow leaves the prey. Wherever you find them, you should make Jihad with them. (Bukhari Shareef, pp/1024)
The local population was being terrorised by the local militants including some foreign militants to enforce Islam in the similar Lal Masjid style actions. The militants calling themselves Taliban killed any one who came in their way including beheadings, their other crimes included kidnapping for ransom, bank robbery and car snatching across the country. On the request of the city government the Army responded and an operation started in September 2007. The militants were being led by a local cleric called Mullah Fazlullah. Soon the militants suffered heavy losses during the operation and were on the run in the mountains.
The militants continued their hit and run tactics as they were being funded from accross the border by anti-Pakistan elements. Swat was still unstable and to bring peace to the area, in April 2009 shariah was enforced in the form of Nizam e Adal and peace deal. The 14 points of the peace deal were of such nature that the militants could not continue their activies, soon they crossed into the adjacent Buner district and started their old dirty tactics to implement their brand of Islam.
In the beginning of May 2009, TTP broke the peace deal following the beheading of two soldiers and other vandalisms as they were upset with the military operation which recently started against them in Buner district because of their infiltration. Fighting started again, this time the nation was taken into confidence and 'Operation Rah-e-Rast' started to slap TTP with a final defeat. By mid of May 2009 Pak Army achieved successes against the TTP and it was on the run and started fleeing the operation areas in garb of civil population by shaving their beards and cutting their hair.