NEW DELHI — Militarily, India fought Pakistan to little more than a draw this month during their most expansive combat in half a century.

Indian forces managed to punch holes in hangars at sensitive Pakistani air bases and leave craters on runways, although only after losing aircraft in aerial face-offs with its longtime adversary.

But strategically, the battlefield tossup was a clear setback for India. An aspiring diplomatic and economic power, it now finds itself equated with Pakistan, a smaller, weaker country that Indian officials call a rogue sponsor of terrorism.

The four-day clash reminded the world of India’s powerlessness to resolve 78 years of conflict with the troubled nation next door.

Any act of confrontation plays into the hands of Pakistan, where friction with India has long been a lifeblood.

Outright military victory is nearly impossible, given the threat from both countries’ nuclear arsenals.

“It’s unfortunate that we in India have to waste so much of our time and effort on what is actually a strategic distraction: terror from Pakistan,” said Shivshankar Menon, a former national security adviser in India. “But it’s a fact of life, and we might as well manage the problem.”

Just how to do that has perplexed Indian leaders ever since Pakistan and India were cleaved apart in 1947.

Interviews with more than a dozen diplomats, analysts and officials paint a stark picture of India’s perpetual dilemma. After multiple wars and several failed attempts at solving their disputes, the problem has only grown in complexity.

India struck Pakistan this month after blaming it for a deadly terrorist attack. The risk of rapid escalation has increased as both sides deploy drones and other cutting-edge weapons on a large scale for the first time.

Superpower politics have entered the equation in new ways, as the United States offers growing diplomatic and military support to India, and China does so for Pakistan.

At the same time, the leadership in each country has embraced religious nationalism, and each has hardened its views of the other, making any conciliatory gesture all but impossible.

The Pakistan army, which has long warped the country’s politics, has taken this ideological turn as it has extended its de facto rule. In India, the shift to strongman, Hindu-nationalist rule has left it boxed in whenever tensions rise, as the right-wing base of Prime Minister Narendra Modi often calls for blood.

That makes it harder for India to show the kind of restraint that it displayed in 2008, when terrorists killed more than 160 people in Mumbai. Then, awareness of how war could set back India’s ascent took precedence over domestic pressure to retaliate.

The Indian government, with Menon then as its highest-ranking diplomat, decided against striking Pakistan after the Mumbai attack. It wanted to keep the global focus on the terrorist attack and to isolate Pakistan for supporting terrorism, rather than elevate it as a battlefield equal.

Seventeen years later, terrorists again attacked innocent people, killing more than two dozen Hindu tourists on April 22 in a scenic Kashmir meadow.

This time, India responded by striking Pakistan militarily, and the two sides stepped to the brink of all-out war.

Indian officials say that they had to send a message that there is a cost to Pakistan’s policy of proxy warfare, and that the strikes were part of a larger strategy to squeeze their adversary, including by threatening to disrupt the flow of crucial cross-border rivers.

Even critics like Menon say they can see why India had little other choice.

For years, India and Pakistan have been on vastly different trajectories.

As India has grown to become the world’s fourth-largest economy, it has been courted by the United States and its allies as a geopolitical partner in counterbalancing China and as an investment destination. U.S. and Indian leaders prefer to talk about an enlarged “Indo- Pacific” region, including the advanced economies of East Asia, rather than old “Indo-Pakistan” problems.

Today, in India’s hierarchy of concerns, “China looks much larger than Pakistan does,” Jon Finer, a former deputy national security adviser at the White House, said on a panel recently.

With Chinese incursions along the countries’ Himalayan border and increased competition for regional dominance, the last thing India wants “is to be bogged down in a conflict with Pakistan while they are figuring things out with China,” he said.

But Pakistan — from its birth dominated by its army, which defined India as the forever enemy to justify its size and influence — always looms in the background.

In 1998, years after the Indian economy started pulling ahead of Pakistan’s, India made an earthshaking step toward joining the ranks of world powers by staging underground nuclear blasts.

Barely two weeks later, Pakistan conducted its own nuclear tests. Suddenly, nuclear deterrence negated India’s military advantage.

President Bill Clinton soon branded the region “the most dangerous place in the world.” It was hardly what India had set out to achieve. Instead of being clubbed with China, Russia and the Western powers, India was in a terrifying new quagmire.

But the nuclear stalemate did not bring peace. Pakistan used its experience of running American-funded jihadist militias against the Soviets in Afghanistan to expand its fight against India.

After the latest hostilities, India has threatened more overt action, saying that any future terrorist attacks will be seen as an act of war — potentially setting up frequent military confrontation as the new norm.

But with the specter of nuclear war, what India can achieve through military force is limited.

“Deterrence is subjective and in the eye of the beholder, a mind-reading game,” Menon said.

The more practical question, he said, is whether India can reset the incentives that drive the Pakistan army.