Following article is published with the permission of the author and is credited to Mr Umar
Afghanistan-Pakistan relations have been strained since the inception of the latter country. To this day the discourse around these relations is emotionally charged with a high level of cherry picking of facts to suit a particular narrative. Part of the discourse are the pre-1979 relations between Pakistan and Afghanistan which are presented as an era of brotherhood between the two countries only to have been strained after the Soviet invasion of Afghanistan in 1979.
The Durand Line
Less than half of the population of Afghanistan are Pukhtoon whose kinsmen reside in parts of Khyber-Pukhtunkhwa province of Pakistan adjacent to the border between the two countries. The Durand Line, as the border is known, was established in 1893 with the consent of the British and Afghan governments of the time. The agreement also included a clause for non-interference by either parties beyond the Durand Line. 
Pakistan gained independence from the British in 1947 and accepted the Durand Line as the border. However Afghanistan did not accept the border  and was the only country that voted against Pakistan’s admission to the United Nations in 1947.  Furthermore, Afghanistan laid irredentist claims to the western areas of Pakistan as part of greater Pushtunistan (or Land of the Pushtuns). 
It is pertinent to discuss how the north-western province of Pakistan (now known as Khyber-Pukhtunkhwa) joined Pakistan constitutionally. A referendum was held in 1947 giving the population of the province an option to either join Pakistan or refrain from doing so. 99% of the votes cast were in favor of Pakistan despite the ruling party, a local branch of the Indian National Congress, having boycotted the referendum on the point that the referendum did not contain any option for greater Pushtunistan (this option was not included as it was contrary to the agreement signed in 1893 and again in 1919). Their boycott meant that the turnout was slightly lower (50.50% of the electorate) than in 1946 General Elections (62.19% of the electorate), a difference of mere 83,871 voters.   However, this result indicated the will of the majority and the province became part of Pakistan.
After independence of Pakistan, Jinnah as the Governor-General tried to emphasize fraternal relations with Afghanistan despite being vexed with Kabul’s position on Pushtunistan. The Afghan royal government protested against the accession of the NWFP province to Pakistan on the ground that the Pushtun region has, ostensibly, never been part of British India.
Faqir Ipi Insurgency
Afghanistan, however, lent further support to a guerilla insurgency under the leadership of Faqir of Ipi which had been fighting the British before 1947. In January 1950, the Faqir proclaimed himself “President of Pushtunistan” following an undemocratic election where less than 10 tribes and only their leaders voted for him.  This led to the Pakistan air force bombing the insurgents’ training camps and hideouts . In September of 1950, Afghan troops crossed into Pakistani territory near the Bogra Pass in a low scale invasion.  Zahir Shah, Afghanistan’s last king, in his 1952 speech stated that the Pushtunistan issue could not be ignored.
In 1955, Afghanistan protested against the creation of West Pakistan as a single unit resulting in the liquidation of the NWFP province (now known as Khyber Pakhtunkhwa). Protests and demonstrations encouraged by the Afghan government, were held in Kabul and several other cities of Afghanistan. Pakistan embassy and consulates were attacked and plundered as there was a rise in problems on the border in the tribal area of Pakistan. In May 1955, Afghanistan declared a state of emergency and carried out a mobilization of its armed forces. Diplomatic relations were severed and the two states found themselves on the verge of war.  In April 1960, Faqir Ipi died and his movement, struggling since the late 50s due to lack of funds from Afghanistan government, was over.
Starting from the 60s, the Pushtunistan Movement weakened in Pakistan owing to the appointment of a large number of Pushtun in Pakistan’s government and bureaucracy, the chief of which were Ayub Khan and Yahya Khan as consecutive heads of state. Undeterred, Afghan government official gazettes published the Pushtunistan flag and Radio Afghanistan ran programs in support of Pushtunistan and Pushtun Baloch Day .
Daud Khan, “Pakhtoon Zalmay” and Bhutto
Daud Khan after deposing Zahir Shah’s government moved closer to both the Soviet Union and India for support of his revolutionary regime in Kabul and also appealed more openly to Wali Khan, a politician and son of Bacha Khan who had boycotted the referendum in 1947, for the tribal Pushtun support. Each time Wali Khan visited Afghanistan he met Daud Khan in Kabul and was hailed wherever he went in the country with shouts of “Pushtunistan Zindabad!” 
Wali Khan’s National Awami Party (currently called ANP) had a militant wing “Pakhtun Zalmay” based in Afghanistan. Baloch Marri tribes and other dissident groups were given shelter by Afghanistan government and training by Afghan Army officers. They were also given monthly stipends by Indian and Afghan governments.  Senior Pushtun politician Afrasiab Khattak was also trained under Pakhtun Zalmay.
Following Daud’s takeover in 1973, an indigenous Islamist movement grew in Afghanistan (itself a majority conservative Muslim country) against the Soviet-backed communist government. In 1975 they tried to overthrow Daud’s government but failed. Following a crackdown, most of the Islamists fled to Pakistan where they were given military training by Pakistan’s government under the direct orders of Prime Minister Zulfiqar Ali Bhutto. 
A tit-for-tat proxy war erupted between the two countries. In 1975, ex-Governor NWFP Hayat Sherpao, was killed in Peshawar by a bomb planted by Pakhtun Zalmay. Zulfiqar Ali Bhutto blamed Wali Khan and Afghanistan. Pakistan government banned NAP, dismissed their governments in NWFP and Balochistan and opened treason cases against NAP leadership also famously known as Hyderabad conspiracy case. 
In 1978, Daud and his family were killed by Afghan Army sympathetic to the Marxist PDPA (Daud’s former allies) in a violent overthrow of the government. They tried to implement the Soviet policy of absolute intolerance to dissent and arrested and killed around 100,000 people in Afghanistan including clerics opposed to forced modernization of the country under the Marxists. This led to open revolt by most of the local population  and the Marxist government responded by signing a treaty with Soviet Union whereby they could ask for military assistance. The government repeatedly escalated the requests for military aid leading to Soviet ground forces entering Afghanistan on December 27th 1979.
As US and USSR were Cold War opponents, the growing Soviet interest and unrest in Iran led to US mending relations with Pakistan (soured after Pakistan’s nuclear tests). The US and Pakistan had common enemies in the PDPA government and the USSR, leading to increased collaboration and the transfer of funds and training of Afghan fighters opposed to the Soviets and PDPA.
Meanwhile in Pakistan, Zulfiqar Ali Bhutto’s government was overthrown by General Zia-ul-Haq in 1977, culminating in the former’s execution in 1979. Bhutto’s sons then created a terrorist organization – Al Zulfiqar. PDPA government gave them shelter and allowed them to carry militant activities against Pakistan from Afghan soil. In 1981, Al Zulfiqar hijacked a Pakistan International Airlines airplane and took it to Kabul where Afghan authorities ensured the negotiations got dragged. Scores of innocent Pakistanis were killed during the terrorist attacks staged by Afghan intelligence agency KHAD inside Pakistan during the 1980s. 
In light of the above historical facts it can be seen that the initiation of hostilities was from the side of Afghanistan which not only refused to recognize Pakistan’s sovereignty and made irredentist claims but also supported insurgencies and proxies inside Pakistan. It was only after nearly 25 years that Pakistan responded with proxies of their own inside Afghanistan. Pakistan’s role during the Soviet-Afghan war also has to be understood in the wider context of the Cold War and its fear of a Soviet Invasion on its own territory as it provided the only direct route to warm waters from Afghanistan. Historical revisionism, where Afghan-Pakistan relations are deemed cordial before 1970s does not help much in attaining peace for two neighbors who are helpless in front of geographic reality of having a long shared border. For reconciliation, accurate history has to be brought forward first.
 Ahmed Shayeq Qassem, “Afghanistan’s Political Stability: A Dream Unrealised”
 Shuja Nawaz, “Crossed Swords”, p.28.
 F. Rabbi, MS Ahmad, “Electoral Politics in the NWFP of Colonial India 1946–47”, History and Sociology of South Asia 8(1) 1–19
 V. Y. Belokrenitsky and V. N. Moscalenko, “A Political History of Pakistan, 1947-2007”, pp. 49-50.
 V. Y. Belokrenitsky and V. N. Moscalenko, “A Political History of Pakistan, 1947-2007”, pp. 69-70.
 V. Y. Belokrenitsky and V. N. Moscalenko, “ A Political History of Pakistan, 1947-2007”, p.85.
 Jummah Khan Sufi, “Faraib-e-Natamam” pp. 318-321.
 Stanley Wolpert, “Zulfi Bhutto of Pakistan”, p.309.
 Jummah Khan Sufi, “Faraib-e-Natamam”, pp. 133-138, 317.
 Stanley Wolpert, “Zulfi Bhutto of Pakistan”, p. 318, p. 322.
 Oliver Roy, “Islam and Resistance in Afghanistan”
 Raja Anwar, “The Terrorist Prince”
About the Author
Umar is a Telecom Engineer with an interest in history & geopolitics. He tweets at @umar8528