THE first law of diplomacy, one late British foreign-office mandarin used to quip, is that “It is not the other side you need to worry about, but your own.” When India’s prime minister met his Pakistani counterpart in New York on September 29th, each had cause to echo the sentiment. Both Manmohan Singh and Nawaz Sharif have, during their respective careers, taken big political risks for the sake of building a durable settlement between the two antagonistic, nuclear-armed neighbours. Yet they have gained little credit for it at home, where powerful forces seek to undermine their efforts.

In the past, Mr Sharif has paid the bigger price. His approach to India helped precipitate the coup in 1999 that ended his previous stint in the prime minister’s office. Indeed, even as Mr Sharif held talks that year in Lahore with Atal Bihari Vajpayee, India’s prime minister, Pakistani troops were infiltrating Indian-controlled territory in Kashmir. The resulting Kargil war killed hundreds and set in train the events that led to Mr Sharif’s toppling by his army chief, Pervez Musharraf.

That was only an extreme example of a common pattern. Just as progress between India and Pakistan seems possible, a military provocation or terrorist outrage blamed on Pakistan rules out any talks. In 2001 it was an attack on India’s parliament. In 2006 it was the bombing of the rail network in Mumbai, in which over 200 died. Two years later a terrorist attack on the city killed almost as many, and continues to poison relations.

This year the trouble has come in Indian-held Kashmir, still claimed by Pakistan, and along the “line of control” that divides it from Pakistan-held territory in the absence of an agreed frontier. A ceasefire across the line observed since 2003 has frayed. In January two Indian soldiers were killed; one of them was reportedly beheaded. In August five more Indian soldiers were killed in the area. And on September 26th a raid by militants on an Indian army base in Kashmir led to at least ten deaths.

Behind all these attacks India sees the hand of the Pakistani state. It accuses the army and its intelligence services of tolerating and even sponsoring anti-Indian extremist groups. It believes that the army (or part of it) thinks its own interests are best served by a perpetual state of tension with India. The generals use this to justify not only the army’s size and budget, but also its continued dominance of Pakistan’s foreign and security policy.

Some Indians see no point in talks with a civilian Pakistani prime minister. The main issue for them is Pakistani-sponsored terrorism. Mr Sharif’s political stronghold is Punjab, Pakistan’s most populous province, where some of the most active terrorist groups have their bases. Yet Punjab has been relatively peaceful, suggesting to some a tacit deal with Mr Sharif. Even if that is not the case, politicians have little control over the extremists. In the longer term, some hawkish Indians see their country as in a secular ascendancy, and Pakistan in perhaps terminal decline. Why sue for peace now, rather than in a few years’ (or decades’) time?

So Mr Singh inevitably faced calls at home not to meet Mr Sharif at all, in protest at last month’s deaths in Kashmir and over Pakistan’s failure (or unwillingness) to bring the organisers of the 2008 Mumbai attacks to justice. Mr Singh rejected such calls. But he risked antagonising Pakistan by calling it, at the United Nations, the “epicentre of terrorism”. And all the meeting produced was an agreement to set up a mechanism for senior army officers to try to reinstate an effective ceasefire.

As for Mr Sharif, not only is he unable to speak with the full authority of the army’s commander; it is also not clear that the present army chief, General Ashfaq Kayani (a former head of the intelligence services), controls the entire security establishment any more. After all, he has publicly insisted that the main security threat facing his country comes not from India but from anti-government extremists, notably those grouped under the umbrella of the Pakistani Taliban. (Privately he is even more outspoken.) Pakistan has suffered an appalling spate of terrorist atrocities in the north-western province of Khyber Pakhtunkhwa. What is more, General Kayani retires in a few weeks.

Meanwhile, some Pakistanis cast doubt on whether Mr Singh is worth talking to. India faces an election by next May, and Mr Singh is almost certain to step down. His Congress party is vulnerable to accusations from the main opposition party, the Hindu-nationalist Bharatiya Janata Party, or BJP, of being weak in the face of Pakistani provocations. Some in both countries argue that only a BJP prime minister in India would be able to make peace. Certainly, the BJP’s candidate for prime minister, Narendra Modi, made hay over Mr Singh’s alleged humiliation by Mr Sharif. This was a consequence, he argued, of Mr Singh’s having been fatally undermined by Congress’s crown prince, Rahul Gandhi, a possible prime-ministerial candidate. Mr Gandhi had flouted government policy by ridiculing a proposed ordinance that would have let convicted criminals carry on serving as politicians.

Doing no harm

In the circumstances, both Mr Singh and Mr Sharif deserve congratulation for having dared to meet at all. Both see the big prizes on offer if peace can be reached: an end to violence in Kashmir, and to futile confrontations such as the stand-off over the Siachen glacier in the Himalayas; a slowdown in a debilitating arms race with a perilous nuclear component; a boost to nugatory volumes of bilateral trade, still hampered by Pakistan’s failure to keep its 2011 promise to reciprocate India’s granting of most-favoured-nation trading status; and, for Pakistan, a chance to concentrate on what General Kayani rightly identified as the main threat, domestic extremism. Yet for now, all those prizes are still at the end of the rainbow. The best that can be said for the efforts by Mr Singh and Mr Sharif to get there is that at least they have not pushed them farther into the distance.

Economist.com/blogs/banyan