Mughul-Yusufzai conflict animosity is said to be deep rooted when Ulugh Baig Mirza (uncle of Zaheer-ud-din Babur) killed almost seven hundred Yusufzais in Kabul. Afterwards Mughuls kings like Babur, Akbar and Aurangzeb tried to subdue them which further intensified the antagonism. The tussle between these old foes ultimately culminated into a resistance movement by the Yusufzais in 1667. They went to the extent of declaring a king of their own and attacking various areas to overthrow the Mughuls and establish their own rule. The Mughuls on their part took the challenge very seriously and made elaborate arrangements to subdue their opponents.
In early 1667, a chief of Yousafzais , Bahaku Khan Mandanr  , with support of Pir Sabak (Mullah Chalak, a man of saintly reputation); organized a lashkar of 5,000 clansmen. They crossed the river Indus and invaded Pakhli plain in the Hazara division. Here Shadman, a local chieftain and other Mughal officers, had their estates. The Yousufzai captured the fort of Chahchal, the seat of Shadman, and began to levy rent from the peasantry. Their success attracted more of their clansmen into the area and their numbers increased. Some Yousafzai bands plundered Peshawar valley. Other Mughal posts in Hazara were also attacked by the Yousafzais .
In the meanwhile Shadman supported by the Mughals, who had been ousted from their posts, organized his men against Yousufzai, then encamped in the Chahch area of Attock. Severe battles were fought in Hazro and Harun villages in Chahch area wherein the Mughals suffered great losses.
Emperor Aurangzeb took immediate counter measures to dislodge the Yousufzai from the newly acquired territory. He gave the following orders,
1- The Faujdar of Attock, Kamil Khan, was to march against the rebels with the available force in his neighborhood.
2- The Governor of Kabul was to send 13,000 men of his contingent.
3- Muhammad Amin Khan , the Mir Bakhshi, was to go there from Delhi with 10,000 picked troops.
The last two contingents took time to arrive on the scene , therefore Kamil Khan, without waiting for them, left Attock with the loyal Khattak and Khokhar levies under their own chiefs, and marched towards the ferry of Harun with a view to cross the Indus and enter the Yousafzai country. Khushal Khan Khattak and his son Ashraf Khan accompanied the Mughal force.
Bahaku Khan anticipated the invasion from the South. He came over to the southern side of the river with full force and held the ferry of Harun against the imperialists. On 1st April, Kamil Khan was reinforced by a detachment of Khokars and Rajputs sent by the Deputy Governor of Peshawar. The Mughal army marched north-eastwards , the Indus, protecting their left flank , their van being led by the Khokar chieftain and their right flank by Raja Maha Singh of the Bhadauriya clan of the Rajputs. Bahaku Khan had organized his force into contingents. For unknown reason he had kept 15,000 men in reserve and 10,000 men in the front. The Mughals attacked the ten thousand men who formed the Yousufzai front ranks. After a stubborn fight, the Yousafzai broke and were driven into the river. The reserve could not reach to their rescue. Consequently , two thousands of them were slain , many wounded , and many more drowned , and remnants found a ford and escaped. Forty prisoners were taken. Kamil Khan erected a pyramid of heads of the slain Yousafzai. The Imperial territory on eastern side of the Indus was cleared of the Yousafzai. 
On the Trans-Indus side, Bahaku Khan remained busy in reorganizing his disheartened lashkar. The Mughal force could not pursue them, as they were not yet strong enough to attempt crossing of the river. So Kamil Khan made a long halt at Harun. Throughout April reinforcements continued to pour in , and on 2nd May Shamshir Khan Tareen (a Pashtun mansabdar of Mughals), at the head of a large detachment from Afghanistan , reached Attock. He took over the supreme command and crossed the Indus into Yousafzai country. Bahaku Khan took up position at Hund , 16 miles above Attock at the mouth of their hilly country.
Shamsher Khan Tareen fought many a battle with them and gained many a success. Entrenching himself at Hund, he burnt the Yusufzai crops in the plain, and destroyed all their farms and homestead in the lowlands. On 4th June , he marched out of Hund to attack Bahaku Khan in his present position. The villages of Panjpir , Chand, Mansur , and four unnamed hamlets, 10 miles from Marghuz , were taken by the imperialists after hard fighting against heavy odds and with considerable losses. The houses were burnt down , the property looted and no vestige of cultivation left. The unrest had spread to other frontier tribes. The Malezai of Swat came to the help of Bahaku Khan. Their excellent marksmanship and fighting skill initially threatened a reverse to the Mughal force. The Yousafzai put up stiff resistance and showed determined resilience. The Mughal assault was effectively stopped at Marghuz. However , the imperial artillery turned the table on them, the Yousafzai were pushed back to their trenches at Mansur on the Panjshir rivulet, which the Mughals, on 28th June 1667 AD, carried at the gallop. Bahaku made his last stand on hilltop where the remnants of his lashkar took up position. However , the Mughals stormed it and dispersed his lashkar. Three hundred Yousufzai were taken prisoners including several Maliks, and many more were either slain or drowned in the river.
Meantime, on 2nd of May, Emperor Aurangzeb, who was determined to root out the menace of the Yousufzai, at least in the plains, sent a force of 9,000 picked Rajputs and Muslims under Muhammad Amin Khan. The Afghan nobles who were part of this force from Delhi, included Qutbuddin Khan Kheshgi, Daud Khan, Shemsher Khan, Allahdad Kheshgi, Diler Khan Daudzai, Sarmast Daudzai and others . On 22nd August, Muhammad Amin Khan crossed the Kabul river at Nari, reached Lakhi, and took over the supreme command from Shamsher Khan Tareen. He won over the Utmanzai clan of the Mandanr Yousafzai to the imperial side, and alliance was now commenced with gifts. After a three days at Lakhi, Muhammad Amin Khan occupied Shahbazgarhi. Making it a strong base, he sent out strong detachments into Bajaur. To further reinforce the royal army, Amir Khan , the Governor of Kabul , moved from Kabul on 28th August and launched a pincer movement from Shehbazgarhi and Bajaur side with a view to trapping the Yousafzai.
The Mughal advanced guards, under Amir Khan, after plundering the villages near Shahbazgarhi and valley of Kashmir , lifted 6000 head of cattle, and fell back on the main army. Muhammad Amin Khan himself entered the Swat valley , destroyed the village of Hijaz, and returned to Hundon 6th October. Here he received orders recalling him to court. Shamshir Khan Tareen was left in command with an addition of 2,000 men to his contingent. For a time the Yousafzai seem to have been subdued by these hard blows or weakened by internal quarrels.
In 1670 AD, Aurangzeb once again sent Mukarram Khan Tareen, and his brother Shamshir Khan Tareen with a big force to chastise the Yousafzai. The latter entered Bajaur from Kabul side and fought a pitched battle with Yousufzai wherein their brother-in-law Mir Azizullah was killed. About that time Bahaku Khan had died. His son Zain Khan succeeded him. The latter visited Mughal Darbar at Delhi and expressed his loyalty to the King. However the hill clans and some of those settled in Yousafzai plain showed no respect to the Emperor. The weak administration caused great disorder. In 1670 AD, Aurngzeb constructed a fort at Langarkot (Garhi Amanzai) against the advice of Khushal Khan Khattak. In the late 18th century, an inscription in Persian was found on a white marble slab at Kapur Garhi or Langarkot amidst the ruins of some old walls , to the effect that,
” In the 12th year of Aurangzeb Alamgir reign, equal to 1080 H, Shamshir Khan Tarin, on the part of the government conquered this country of Mandnar and constructed this fort, mosque and well “. 
H.W. Bellew in 1804 notes that ruins of fort , mosque and well still exist , and are almost the only remains of red brick buildings in the whole district. The Tablet was sent to Peshawar Museum by Captain Shortt, who first discovered it.
The aim of Mughals, however, was not achieved. Misri Khan son of Jewan Khan, one of the right hand men of Bahaku Khan, kept on raiding Mughal posts. Misri Khan was poisoned by Allahdad Khan , the Mughal subedar in the fort of Langarkot. Reportedly , the poison was injected in a watermelon.
Notes and References:
The book reference: “History of the Pathans”, Vol-II by Haroon Rashid as well as some other books,
1- Bahaku Khan was fifth in lineal descent from Mandanr from Saddozai clan- “Tawarikh-i-hafiz Rahmant Khan, p-493
2- Maasir-i-Alamgiri, p-66
3- Haroon Rashid, “History of the Pathans”, Vol-II, p-93
4- Ibid, p-94
5- Rita Joshi, “Afghan nobility and the Mughals”, p-168
6- H.W.Bellew, A General Report on the Yousufzai, p-74