Demonstrators in Lucknow, India, beat an effigy of Pakistan’s Prime Minister Nawaz Sharif during a protest against what they say is the death sentence given to former Indian naval officer Kulbhushan Jadhav in Pakistan. (Pawan Kumar/Reuters)

Are India and Pakistan an execution away from possibly the worst crisis in South Asia since the Mumbai terrorist attacks of 2008?

India has warned of “consequences” for “premeditated murder” if Pakistan hangs Kulbhushan Jadhav, a former naval officer, who was sentenced to death on charges of espionage by a secret military court. From Washington, what may seem to be a routine spat between two quarreling neighbors is a reminder that democracy in Pakistan remains a cosmetic mask camouflaging the real power center — the country’s military and intelligence agencies.

In this case, India has rubbished the claim that Jadhav is a spy, instead arguing that he was kidnapped by Pakistan’s intelligence agencies from Iran and mysteriously produced inside Pakistan’s troubled Balochistan area. India says that his videotaped ‘confession’ (released last year) was coerced and that no spy would travel on a covert mission carrying an Indian passport. India says that 14 different requests for consular access have been denied, in breach of international protocol.

In any case, whether Jadhav is a spy is moot. What is beyond dispute is that the Pakistan Army’s declaration of a death sentence for him via a clandestine court-martial breaks with all standard practice; it is almost an open invitation to escalation from India.

Shockingly, the announcement of Jadhav’s death sentence this past week was made by the Pakistan Army and not the government’s foreign office. The sentencing seemed to take the Nawaz Sharif-led civilian government entirely by surprise, even as Indians were convulsed with rage. Pakistan’s foreign minister Sartaj Aziz said last year that there was no “conclusive evidence” against Jadhav. So the sudden announcement appears to be as much about Nawaz vs. the Pakistani Army as it is about India vs. Pakistan. With Pakistan’s military stripping away the veneer of authority from its civilian prime minister, the aim could be to further weaken him and ensure that he is unable to steer the wheel in the direction of a dialogue with India.

If Nawaz is allowed to finish his term next year, it will be only the second time in Pakistan’s history that an elected civilian government would have completed its five-year tenure. But while that may make Pakistan appear that it is in a post-coup era, the country remains a military democracy, where there is more power in the barracks than the ballot.

Last year, banners surfaced asking for the powerful army chief Gen. Raheel Sharif to take over government; Imran Khan, the cricketer turned opposition leader, echoed the slogan. When Raheel Sharif finally retired (he now heads the Saudi Arabia-led Muslim alliance against terrorism) he was the first military chief in 20 years to not seek an extension.

Thus, the surprise secret trial of Jadhav and the shock announcement look like another opportunity for the Pakistan Army to upend a prime minister who is already vulnerable, as Nawaz Sharif is facing an impending court verdict against his family members in the Panama papers scandal. On a recent trip to Pakistan, I was told that he was trying to resuscitate the gasping India-Pakistan dialogue and that a back channel had opened up between the national security advisers of the two countries. The Jadhav death sentence ends all of that; India has scrapped scheduled maritime talks with Pakistan as tensions spiral. And as the prime minister’s authority stands diminished, that could be precisely what the Pakistan military wanted.

“The timing and manner of announcement of the Jadhav decision indicates that it is either a bargaining chip to exchange someone in India’s custody or is meant to deter the country’s civilian prime minister from any new initiatives to mend fences with India,” Hussain Haqqani, Pakistan’s former ambassador to the United States, told me. Haqqani was the diplomat who brokered the release of CIA contractor Raymond Davis, who was convicted of double murder in Pakistan. Like all seasoned practitioners of statecraft, he knows that Pakistan is unlikely to take things to a dangerous precipice with India over the arrest of a spy; the motive lies elsewhere.

Another explanation: Pakistan wants to use Jadhav as leverage to counter the aggressive global push by Delhi to isolate Islamabad as the perpetrator of state-sponsored terrorism. But the Narendra Modi government has never gone by the conventional playbook on Pakistan. From dropping in to visit Nawaz Sharif on his birthday to surgical strikes across the line of control, the Indian prime minister has followed his own script of shock and awe on Pakistan, in both friendship and hostility. Pakistan’s move on the tactical chessboard may prove to be a gambit gone wrong if India decides to play back in kind.