NEW DELHI — The bitter and sometimes violent rivalry between India and Pakistan shows no signs of abating, but many in New Delhi greeted Sunday’s election results in Pakistan with measured optimism on Monday.  Nawaz Sharif, who is poised to become the next prime minister of Pakistan, has often said he would like to improve ties with India. Indians who closely follow diplomatic developments believe that Mr. Sharif will have to reach out to his giant neighbor if he hopes to turn Pakistan’s moribund economy around and improve vital services like electricity generation.  But analysts in India disagree about whether Pakistan’s powerful military and intelligence services are likely to allow Mr. Sharif to make lasting peace with India. K.C. Singh, a former counterterrorism coordinator and former Indian ambassador to Iran, said the greatest danger to progress may lie in Mr. Sharif’s making an overture before he has a solid hold on his country’s powerful security infrastructure.  “The risk is that he will go too fast, and the military will undertake a strike against India and set everything back,” Mr. Singh said. “Sharif has a lot of work to do before he can fundamentally change the relationship with India.”  Lalit Mansingh, a former Indian foreign secretary and former ambassador to the United States, said he was pleased with Mr. Sharif’s victory, even though he did not expect any rapid changes. “Looking at the range of candidates in Pakistan, Nawaz Sharif was definitely our best bet,” he said.  Relations between India and Pakistan nose-dived after a militant group based in Pakistan carried out terrorist attacks in Mumbai in 2008, killing 164 people. Pakistan initially denied that any of its citizens had taken part in the attacks, and the country has done little to prosecute those who helped plan it. A result has been a long cold spell with India.  But Pakistan’s growing problems with its militant groups, including the Taliban, suggest to many in India that the sword Pakistan had hoped to use against India now threatens Pakistan as well. The hope here is that Pakistani leaders will conclude that all terrorist groups must be eliminated, even those whose mission is to attack India.  “I’m guardedly optimistic,” said Gopalaswami Parthasarathy, a former Indian ambassador to Pakistan.  Mr. Parthasarathy said that neither government had had the will or the credibility to attempt an ambitious reset of relations. India’s government is hindered by corruption scandals and a slowing economy, while Mr. Sharif faces the need to tame his generals, he said. Even so, incremental progress is possible on economic cooperation, eased visa restrictions and some power deals, he said.  Prime Minister Manmohan Singh of India congratulated Mr. Sharif on his victory Sunday. “The people of India also welcome your publicly articulated commitment to a relationship between India and Pakistan that is defined by peace, friendship and cooperation,” he wrote.  An editorial in The Hindustan Times on Monday stated that “India has genuine reason to be pleased” with the results of Pakistan’s election.  “India should not expect a Kashmir settlement or the arrest of Hafiz Saeed in a few months’ time,” the editorial stated, referring to a leader of a militant group linked to multiple terrorist attacks in India. “What it can hope for is a government,” it continued, “that will understand that cutting dependence on the United States and China is only possible if Pakistan has a modus vivendi with India.”  Still, some in India were dismissive of the idea that Mr. Sharif or any elected politician in Pakistan could change the decades of animosity between the nuclear-armed neighbors.  “I’ve always believed it’s ultimately the generals who decide on Pakistan’s security policies,” said Vivek Katju, a former Indian ambassador to Afghanistan. “And they have not changed.”
Some Indians believe that the man poised to become Pakistanâs next prime minister will seek economic cooperation despite the bitter rivalry between the two neighbors.