(CNN) When two populists go to war, there is every chance their people will suffer more than they will.

These are the stakes that face both the recently-elected Imran Khan in Pakistan and Narendra Modi, of the Hindu Nationalist Bharatiya Janata Party (BJP) in India, who is soon to face the electorate again.

To avoid escalating their current confrontation, the two prime ministers will have to face down the powerful pull of historic rivalries and mistrust, coupled with the more immediate needs of their own political careers.

Both countries say they don't want war.

After striking what Delhi said was a terror training camp in Pakistan on Tuesday, India's Foreign Minister said: "India does not wish to see further escalation."

The next day, after Pakistan's air force claimed it had shot down two Indian jets and captured a pilot, Khan said: "We should resolve our problems by sitting down and talking."

Fraught history

The history the two nuclear-armed nations share does not bode well for avoiding confrontation.

Since Britain cast off its colonial ambitions in the region following World War II and India and Pakistan were created, the countries have fought four wars, and almost come to additional blows numerous times. They still dispute territory across the "line of control," a sort of de facto UN border in the contentious Kashmir region.

A more fundamental fault line divides the nations too. Religion.

As Britain handed Indians the country, many of its Muslims sought refuge from persecution in Muslim-majority areas. Pakistan de-facto came into being as an Islamic state, a safe haven for Muslims in the bloody separation from the Hindu majority in India.

Despite all this, the two sides do talk to each other. Several times a day, they engage in theatrical flag-raising and lowering ceremonies at the Wagah-Attari border crossing at the demarcation line dividing India and Pakistan.

Both sides choose their tallest troops for the ritual, who engage in the most exaggerated leg-raising marches imaginable. They do it with a flair and flamboyance that belies the implicit threat.

A friend once likened the spectacle to a "thermonuclear Disneyland."

Yet, these nations have been capable of -- but have resisted -- unleashing an unimaginable Armageddon for the past two decades. Pakistan tested its first nuclear bomb in 1998, just weeks after India conducted its first round of tests since the 1970s.

Nuclear powers

Pakistan is a relative sliver of a country, while India is vast and sprawling with a population of close to 1.3 billion that dwarfs its neighbor's sixfold.

It is Pakistan's inherent geographic insecurity that drives every national security decision it takes -- and that includes supporting the Taliban in Afghanistan to give it "strategic depth" should India invade.

A Indian army camp in 1991 at the Siachen Glacier.

India and Pakistan also share the world's highest battlefield on the Siachen Glacier in the Himalayas. There, just north of the end of the Line of Control, the two nations hold front line positions some 20,000 feet above sea level.

But it is the low lying populist plains in its south that Pakistan most fears are weak to an Indian invasion. Lahore, the capital of Pakistan's breadbasket state Punjab, lies less than an hour's drive from the Wagah-Attari border and the towering flag-ceremony guards.

Bloody and brief

Previous wars between Pakistan and India have been bloody and sometimes brief -- but once unleashed they have mostly been fought full throttle.

The 1947 war resulted in the Line of Control being established. The second, in 1965, involved a face-off between armored vehicles, resulting in thousands of casualties. The 1971 war was the only one between the nations that didn't involve Kashmir, and resulted in the formation of Bangladesh.

The last significant confrontation -- the Kargil War -- was in 1999.

But the wars are only one contributor to the mutual resentment between the two countries. A series of high-profile terror attacks in recent years have further soured relations.

In November, India marked 10 years since the terror attacks in Mumbai, which lasted over several days of gun battles and explosions at a major tourist hotel and a Jewish organization in the sprawling port city. The 2008 massacre left 164 people dead.

The 10 attackers came from and were controlled out of Pakistan by a group called Lashkar-e-Tayyiba, which has ties to Pakistan's intelligence service, the ISI. India executed the only surviving attacker. Pakistan jailed, but then released, the terror group's leader.

To say that deep mistrust corrodes the relationship between Indian and Pakistan is to understate the inculcated animosity that infuses both nations and underpins the hair-trigger instincts of their armed forces.

Pressure is on

Khan, the former cricket legend, who came to power with a populist message that appealed particularly to conservative Muslims, is new to his role as Pakistan's leader. The pressure to stand up to India will be immense.

He acknowledged as much in his address to the nation on Wednesday: "We only wanted to tell India that we have the capability, if you come and carry out an activity on our land, we can also come over and do the same in your land. That was the only objective."

Modi, by contrast, has already proven himself in his role -- but must do it again to get elected.

His critics, both inside and outside India, complain he has enabled the more base elements of his Hindu nationalist BJP party, and point to rising persecution of India's Muslims as an indication of where his political instincts lie.

Since they became nuclear powers, every time India and Pakistan have gotten to the point of toe-touching, eye-staring aggression the international pressure on them to step back from the brink has ratcheted up.

It's no different now, with the US, UK and even China imploring both countries to back off in the past 48 hours.

We can only hope they will. The alternative could be too terrible to contemplate.