Julian Huxley once wrote that "a nation is a society united by a common error as to its origins and a common aversion to its neighbours".

If there is any truth to Huxley's remark, the recent bloody border clashes between the Afghan and Pakistani military forces illustrate the common aversion of the Afghans towards their antagonistic eastern neighbours, Pakistan.

The incident, which left three border guards and two children dead on the Afghan side of the Torkham crossing in eastern Afghanistan, stirred anger throughout the country.

Transcending internal differences, Afghans poured into streets in protest and some began marching towards Torkham to render support to the Afghan National Army.

A video clip has gone viral on the social media, showing a group of men, claiming to belong to the Taliban forces, declaring war on Pakistan and urging others to join in defending Afghanistan's honour and territorial integrity.

Face-saving attempt

Many Afghan observers think that the incursion was a face-saving attempt by Islamabad to divert domestic attention from its recent setbacks, particularly the US drone attack that killed Taliban leader, Mulla Mansour, in Pakistani territory.

ALSO READ: Ashraf Ghani - A return to traditional Afghan governance

Other disconcerting events of late include the US shift of policy, indicating the end of favouritism to Pakistan, and the opening of Chabahar port, a collaboration of Iran, India and Afghanistan that could isolate Pakistan in regional trade activities.

The seemingly disarrayed, multiethnic Afghan nation came together and showed a common aversion to their aggressive neighbour.

Yet others think that Pakistan was testing the waters and was trying to take advantage of what it perceived as a vulnerable moment in Afghanistan.

A year that has been marked with the highest military and civilian casualty figures and increased political discord in Kabul would probably be an opportune time to settle the disputed border issue.

In either case, Pakistan's calculus proved wrong. The seemingly disarrayed, multiethnic Afghan nation came together and showed a common aversion to their aggressive neighbour.

Beyond a show of unity in the face of foreign aggression, however, the phenomenon signals a wider shift of dynamics in the two neighbours' historically thorny relationship.

The majority of Afghans believe that since the days of the Afghan resistance against the Soviet invasion in the 1980s, Pakistan has been playing a ruthless game of manipulation with both the Afghans and their largest benefactor, the US.

Indispensable ally

Since 2001, posing as an indispensable ally in the war against terrorism, Pakistan has been benefitting from a lavish US military and development aid, while continuing to provide a safe haven for the Taliban and the Haqqani network.

The two groups have been responsible for tens of thousands of Afghan casualties and more than 3,500 US military and civilian fatalities.

In the political arena too, Pakistan had skillfully presented itself as the key to peace in Afghanistan and in the war against international terrorism, while threatening the Americans that turning away from Pakistan would result in "nuclear terrorism".

Some argue that Pakistan's interference in Afghan's internal affairs is driven by its insecurity about the Durand Line, the disputed border demarcation upon which the Torkham crossing sits.

As soon as Kabul accepts it as the official dividing line, the argument goes, Pakistan will stop its meddling.

ALSO READ: Death of a warlord will change nothing in Afghanistan

While there are ways to resolve the Durand issue through pragmatic and mutually beneficial formulas, Pakistan has been fixated on imposing recognition of the border by Afghanistan without making any concessions.

Pakistan's ambitions, however, are greater. Their doctrine of gaining "strategic depth" in Afghanistan, which is justified by their fear of an attack from India, is one of the reasons for Islamabad's relentless efforts to install a puppet government in Kabul.

The ISI intelligence agency's grossly misguided Taliban project eventually gave birth to various groups of Pakistani Taliban, the survival of al-Qaeda and the harbouring of various Central Asian and Chinese radical groups.

But Pakistan could not have become a godfather of sorts to most of the world's terrorist organisations had it not been for the puzzling acquiescence, over the past 15 years, of the United States.

Whether it was a case of prolonged underestimation, a strong and generous Pakistani lobby in Washington, or simply a chaotic AfPak strategy - or lack thereof - the US did not challenge Pakistan's behaviour in any serious and consistent manner.

But, finally this spring, American policy-makers felt the fatigue from Islamabad's double games. In March, the US Congress began to voice doubts about the continuation of the flow of US aid to Pakistan.

In May, Congress passed a bill imposing strict conditions on a $450m aid package to Pakistan and opposed the financing of eight F-16 jet fighters that would be granted to Pakistan through the Foreign Military Financing scheme.

Since 2002, the average annual US aid to Pakistan has been roughly $2bn. In 2010 alone, Pakistan received about $4.5bn in military and development aid from the US. Yet, public opinion polls in Pakistan show that the majority of Pakistanis view the US as an enemy.

The Afghan government's policy of genuinely trying to make peace with its neighbour and changing Pakistan's Taliban game was initiated at the beginning of 2015.

China, a long-time ally of Pakistan, and the US, the biggest donor of Pakistan, got on board, and the Quadrilateral Group - along with Afghanistan and Pakistan - launched a fresh round of peace efforts.

This, along with several regional economic cooperation initiatives involving Central, West and South Asian states provided Islamabad with the perfect opportunity to turn around and abandon its Taliban project.

But, Pakistan missed the chance and stubbornly stuck to its old Afghanistan policy, and the Taliban expanded and intensified its onslaught.

The Afghans' reaction to the recent border incident represents the culmination of over three decades of frustration with Pakistani malfeasance. They have fought the British and Soviet empires against all odds. If pressured and humiliated further, the Afghans might take on Pakistan.

Therefore, while the killing of the former Taliban leader, Mulla Mansour, the imposition of conditions on aid to Pakistan and the expansion of military role in Afghanistan are positive signals in the US policy on Afghanistan and Pakistan, staying the course will be the determining factor in changing Pakistan's behaviour.

Helena Malikyar is an Afghan political analyst and historian.

The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.