Islamabad - Deadly violence over the last week along the disputed Kashmir border between Pakistan and India threatens to sabotage recent efforts by the nuclear-armed rivals to improve ties, illustrating how vulnerable the normalisation process is to spoilers from both sides.
The most dangerous of these potential spoilers are Islamic militants who have historically been nurtured by the Pakistani military to fight a covert war over Kashmir and may feel threatened by any indication the government is cozying up to India.
The Pakistani army and its militant proxies have a history of using violence to sabotage outreach to India by civilian leaders, and suspicion about the generals' intentions still runs high in New Delhi.
But many Pakistani analysts believe the army's leaders have little interest in rocking the boat now, raising the worrying possibility that the recent violence was sparked by militants who have gone rogue or are operating in cooperation with lower level military officials sympathetic to their cause.
"This has really pulled the rug from under the feet of Nawaz Sharif and Manmohan Singh", the prime ministers of Pakistan and India, said Moeed Yusuf, a Pakistan expert at the United States Institute of Peace.
Both leaders have expressed a desire to improve ties, especially to increase cross-border trade.
The US is likely watching the current tension closely, both because of the nuclear arms on both sides and the spillover effect that conflict between the two countries has in neighbouring Afghanistan.
The US has long suspected Pakistan of supporting Taliban militants in Afghanistan to counter Indian influence.
Majority Muslim Pakistan and predominantly Hindu India have fought three major wars since they both gained independence from Britain in 1947, two of them over Kashmir.
The disputed territory is divided between the two countries but claimed in its entirety by both.
A 2003 cease-fire agreement has largely calmed the disputed border between the countries, although they occasionally accuse each other of violating it by firing mortars or gunshots, and several soldiers were killed on each side in January in cross-border attacks.
New round of violence
The latest round of violence began last Tuesday when, according to the Indian military, 20 heavily-armed militants and Pakistani soldiers crossed the Kashmir border and killed five Indian troops.
The Pakistani military has denied that its soldiers killed any Indian troops and accused Indian soldiers of killing a pair of civilians and wounding two others along the border over the last week.
The latest accusation came on Wednesday when a Pakistani military official said Indian troops shelled the Battal sector of Pakistan-held Kashmir on Tuesday night, killing one civilian and seriously wounding another.
An Indian army officer denied the allegation, saying there was no shelling or exchange of gunfire in the sector. Both the Pakistani and Indian officials spoke on condition of anonymity in line with military policy.
Pakistan's new prime minister, Sharif, took office in June with a pledge to improve relations with India to help turn around his country's stuttering economy.
Trade between the two countries is around $2bn per year and could go as high as $11bn once trade is normalised, according to some estimates.
Pakistani Finance Minister Muhammad Ishaq Dar indicated earlier this week that the government was backing off granting most favoured nation trading status to India in the wake of the violence on the Kashmir border.
But Sharif has expressed hope that the normalisation process would continue and said he looks forward to meeting with his Indian counterpart on the sidelines of the UN General Assembly meeting in New York in September.
"Pakistan will continue to respond to the situation with restraint and responsibility in the hope that steps would be taken by India to help reduce tensions," Sharif said on Wednesday. "Our objective is peace. For that, what we need is more diplomacy."
Sharif, who has served as prime minister twice before, has experience being undermined in his efforts to reach out to India. He signed a landmark agreement with the country in February 1999 that sought to avoid nuclear conflict, but the goodwill didn't last long.
In May 1999, the Pakistani army chief at the time, General Pervez Musharraf, quietly sent soldiers into an area of Indian-held Kashmir called Kargil, sparking a conflict that cost hundreds of lives and could have led to nuclear war.
Sharif said the army acted without his knowledge. Five months later, Musharraf toppled Sharif in a coup and sent him into exile in Saudi Arabia, not allowing him to return until 2007.
Yusuf, the Pakistani expert, said he believes the army's leaders are now on the same page as Sharif in terms of gradually improving ties with India because the military has its hands full fighting a deadly Taliban insurgency.
He believes it is more likely that militants sparked the latest crisis, possibly with help from lower-level military officials.
"That is even more dangerous," said Yusuf. "I keep saying to people that I would much rather have a Pakistani state in control of these buggers, rather than having them running around and doing whatever they are doing."
For example, the Pakistan-based militant group Lashkar-e-Taiba, which was established with help from the military, is believed to have carried out an attack on the Indian city of Mumbai in 2008 that killed over 160 people.
The attack followed efforts by Pakistan's newly elected government to improve ties with India.
Indian officials have been more hawkish in their statements following the recent round of violence than their Pakistani counterparts, likely because national elections are scheduled for next year and politicians don't want to be seen as soft on Pakistan.
Indian leaders have long been frustrated by Pakistan's failure to crack down on Lashkar-e-Taiba. That frustration could grow with Sharif since he has shown no inclination to target the group, which is based in his party's stronghold of Punjab province.
The group's founder, Hafiz Saeed, operates freely despite a $10m US reward for information leading to his arrest and conviction.
"If you think the Pakistan government is going to take any action against the Lashkar, the answer is no," said Gopalapuram Parthasarathy, a former Indian high commissioner to Pakistan.
"When you don't take action against the Lashkar, and it feels free, then the Pakistan army is going to let it loose against India" at home and in Afghanistan, said Parthasarathy.
Maleeha Lodhi, a retired Pakistani diplomat, said the recent violence likely means Sharif will have to put his plan to improve relations with India on hold until after the Indian elections.
"I expect these tensions to eventually die down," said Lodhi. "But what they have done is circumscribed the space even further."