Hong Kong (CNN) Tensions on the border between India and Pakistan last week pushed the two nuclear-powered South Asian adversaries closer to conflict than at any point in the past two decades.

While the situation has calmed -- Pakistan on Friday released an Indian air force pilot it captured after shooting his pane down -- drastic swings in relations are the norm. Both countries know the risks when tensions spike.

Following their separation in 1947, relations between India and Pakistan have been in a near constant state of agitation. The two sides have fought several major wars -- the last being in 1999 -- involving thousands of casualties and numerous skirmishes across the Line of Control in the contested Kashmir region

Since that last clash, both countries have quietly sought to enlarge and upgrade their military capabilities.

Indian M777 howitzers are displayed during a rehearsal for the Republic Day Parade on January 23, 2019, in New Delhi, India. The guns are top-line US technology, analysts say.

With its military buildup over those decades, India now exceeds Pakistan on most numerical measurements -- fighter jets, troops, tanks and helicopters.

India far surpasses Pakistan in other measures, too, especially in military budget, $64 billion to $11 billion, according to the Stockholm International Peace Research Institute (SIPRI).

But, as is often the case, numbers don't tell the whole story.

The China question

India has about 3 million military personnel compared to fewer than 1 million for Pakistan, according to the International Institute for Strategic Studies, but New Delhi can't focus them all on its neighbor to the west.

A chunk is focused on India's northeast and its border with China.

"India's strategic problem is bringing its heft to bear. It has traditionally had to split its forces and leave some in the east to deter Chinese adventurism," said Peter Layton, a former Australian Air Force officer and now fellow at the Griffith Asia Institute.

In 1962, India and China engaged in a bloody border war and skirmishes have continued to break out sporadically throughout the subsequent years, most recently in the Doklam area in 2017

Chinese troops march during a Pakistan Day military parade in Islamabad on March 23, 2017.

And China is able to keep Indian attentions divided by keeping a close military relationship with Pakistan.

"There is a convergence with Chinese and Pakistan strategic thinking that has continued for five decades now," said Nishank Motwani, a visiting fellow at the Asia-Pacific College of Diplomacy with expertise on India and Pakistan.

China plays another role as Pakistan's biggest arms supplier -- with a whopping 40% of Beijing's military exports going to Islamabad, according to data from a December discussion of Pakistan at the Brookings Institution in Washington.

India's ties to the West

While Pakistan has formed a close relationship with China, India -- with a defense budget six times the size of Pakistan's -- has been on a rapid military modernization program of its own.

"India has more spending power and has been investing in platforms that Pakistan can't afford," Motwani said.

Among recent acquisitions are airborne early warning and control aircraft with Israeli technology and US airframes and US-made artillery it is deploying along the Kashmir line of control to replace 1980s' Swedish guns, said Motwani.

India wants even more new military technology, but it is often hamstrung by tight export controls from key suppliers like the US and Britain.

Other experts say India is also hurt by a poor domestic military industrial base.

Pakistan, meanwhile, is making its own fighter jets, Chinese-designed JF-17s.

A Pakistan JF-17 performs at a Paris airshow in 2015.

According to some reports, It may have been one of those jets that on Wednesday downed an Indian Air Force fighter plane, leading to the capture by Pakistan of an Indian pilot.

That Indian jet was a MiG-21. A Soviet-designed aircraft, it has been in service since the 1960s, and the Indian Air Force still says it "forms the backbone" of its fleet with about 200 in inventory.

But Motwani says Indian pilots call the old jet "the flying coffin" for the accidents it has been involved in.

An Indian Air Force MIG-21 performs at an airshow in February 2019.

And that illustrates a problem for India. While it has a massive military budget, a significant chunk of that goes toward maintenance of existing equipment, and salaries.

"Modernization gets a mere 14% (of allocated funds), which is grossly inadequate," according to an Indian Parliament committee inquiry on military readiness last year.

The size disparity

India, with a landmass nearly four times that of Pakistan, can put military assets well back from tense border regions, where any Pakistani strikes against them would encounter multiple layers of air defenses.

In the smaller and more narrow Pakistan, military bases and assets are harder to shield.

"Pakistan lacks strategic depth," Motwani said. "A lot of Pakistan bases are close to India which makes them easy targets for Indian forces."

To carry out any attacks, India has the variety and number of aircraft -- fighters, ground-attack, tankers and AWACs -- that Pakistan just can't match.

"Large raids would be hard to stop although some losses would be expected," Layton said.

While the air advantage seems to lean India's way, large-scale ground actions across the border would be tougher for India.

"Pakistan has a network of canals along the international border to make it harder for Indian formations to move into Pakistan," said Motwani. It's old school warfare, not far removed from the trenches of World War I.

At sea, the advantage is clearly on the Indian side.

Pakistan, with a much smaller coastline to defend, has put the lion's share of resources into its army and air force, Motwani said.

New Delhi has an aircraft carrier and nuclear-powered submarines in its fleet, he said, assets Pakistan can't come close to matching.

The nuclear threat

One area where Indian and Pakistan are evenly matched is the area that raises the most worry whenever hostilities spike between the two -- nuclear weapons.

Figures from the Stockholm International Peace Research Institute last year show Pakistan with 140 to 150 nuclear warheads and India with 130 to 140.

Layton worries that if the situation gets dire for Pakistan -- something that's far from what we're seeing at the moment -- they could be used before commanders in Islamabad could stop them.

"Pakistan has a strategic policy of delegating nuclear release approval down to lower level tactical units," he said. "There is a real danger of 'loose nukes,' that is lower-level bellicose commanders using tactical nuclear weapons if they see fit."

Motwani said Pakistan wants India to know that nuclear threat is always there.

JUST WATCHED Pakistan FM: "Pakistan never wants to escalate" Replay More Videos ... MUST WATCH Pakistan FM: "Pakistan never wants to escalate" 10:28

That leads back to how the current spike in hostilities began, when a Pakistan-based terror group struck an Indian military convoy in Indian-administered Kashmir on February 14, killing 40.

"Pakistan can use terrorist groups. That's a military strategy it has used for decades as a way to bridge the military gap with India," Motwani said.

And every time India contemplates retaliation, the nuclear threat is there.

"It uses its nuclear weapon capability as a firewall that it uses to carry out terrorist strikes in India with impunity," he said.