At the beginning of 2004, the Pakistani central government sent 80,000 soldiers to the tribal areas. There, mainly in South and North Waziristan, there were clashes between Pakistani troops and the Taliban and other fighters, each joined by local clans. Several hundred Pakistani soldiers died in this conflict by 2006. Due to an initiative of the governor of the NWFP, Ali Muhammad Orakzai, a jirga was convened at this time, which was hoped to bring an end to the fighting. As a result of this meeting, the Pakistani government concluded the Miranshah Agreement with the tribes of North Waziristan on September 5, 2006. The key points were a withdrawal of the Pakistani army from the tribal areas and the cessation of hostilities by the Pakistani armed forces. Instead, tribesmen were to replace government troops and provide protection for the local authorities.
The Miranshah Agreement of 5 September 2006 ended the disputes between the Pakistani government and the majority of local tribes. However, it was criticised for encouraging rather than stopping Taliban influence. The Taliban subsequently assassinated several tribal leaders who had co-signed the agreement and continued their expansion. In 2007, the Taliban openly recruited new members in madrasas and attempted to force their cooperation by attacking school authorities. The Taliban also carried out attacks against establishments that were not compatible with their worldview, such as music and video stores and fashion shops. In addition, the Taliban targeted criminals as well as authorities. At this time, they increasingly took hostages among the region's police forces, thereby freeing imprisoned fellow fighters. In December 2007, the various Islamist and Taliban groups merged to form "Tehrik-i-Taliban Pakistan" (TTP), the Taliban movement in Pakistan. The leader of this organization became the Islamist and tribal leader Baitullah Mehsud. According to Harvard scholar Hassan Abbas, Mehsud's goals were to introduce Sharia law into Pakistan, to continue the fight against NATO in Afghanistan, and to wage a kind of "defensive jihad" against the Pakistani army and an uncompromising line against the Pakistani government. Abbas estimated that Mehsud had about 5,000 men under his command.
So far, the Pakistani military has been able to win almost every battle against the militants. However, militancy still remains strong in various parts of the North West Frontier Province. In 2008, Pakistan's military and the Frontier Corps received counterinsurgency training from Britain and the United States. When Mehsud died in a U.S. drone strike in early August 2009, violent clashes erupted over his succession, from which Hakimullah Mehsud emerged as the Taliban's new leader.