Indian prime minister Narendra Modi makes a surprise stopover in Pakistan to meet his counterpart, Nawaz Sharif, in the first such meeting between the nuclear-armed rival nations in over a decade. (Reuters)

A surprise visit to Pakistan by India’s prime minister, Narendra Modi, on Friday pressed the reset button on the blow-hot-blow-cold relationship between the two nuclear-armed neighbors, paving the way for official dialogue to resume next month.

On his way back from Afghanistan, Modi stopped over in Lahore for an unscheduled meeting with Pakistani Prime Minister Nawaz Sharif, after a surprise announcement on Twitter that sent analysts on both sides of the border into a tizzy.

The last time an Indian prime minister had visited Pakistan was in 2004. Sharif, however, came to India last year to attend Modi’s swearing-in ceremony.

After addressing a joint session of the Afghan parliament early Friday, Modi tweeted that he greeted Sharif on his birthday and that he is “looking forward to meet PM Nawaz Sharif in Lahore today afternoon, where I will drop by on my way back to Delhi.”

The two leaders met for a little less than two hours at Sharif’s festively lit ancestral home in Lahore, where they talked about improving ties.

“Beyond the noise, a personal connect. The Prime Ministers discuss India Pakistan relations,” tweeted Vikas Swarup, a spokesman for India’s Ministry of External Affairs. He added that Modi met Sharif at his home as “a special gesture” and blessed the latter’s granddaughter ahead of her wedding.

India’s NDTV 24x7 news channel called it “Modi’s masterstroke.” In Pakistan, the phrase “birthday diplomacy” trended.

A statement from Pakistan’s Ministry of Foreign Affairs said the leaders “expressed their desire to carry forward the dialogue process for the larger good of the people of the two countries.”

Pakistani security analyst Rifaat Hussain said the symbolism of the visit is “huge.”He added that the meeting is likely to have been preceded by some “behind the door” preparation.

Modi’s colleagues in his Bharatiya Janata Party said, however, that there was no secret back-channel planning and that the meeting was spontaneous.

“It was a spontaneous but bold and innovative decision to visit Pakistan,” said Nalin Kohli, a spokesman for the BJP. “The India-Pakistan story has many difficult issues lingering for decades. It is not an easy path ahead. But the two leaders are trying to establish a personal equation that can add momentum to the structured process of official talks in the future.”

The two leaders last met during the climate change conference in Paris in November, chatting briefly.

Analysts said the prospect of the Friday meeting was probably kept hidden until the last minute to prevent the irrational expectations and acrimony that often accompany any such diplomatic move.

Since independence from British colonial rulers in 1947, the two countries have fought two of three wars over Kashmir, a Himalayan region claimed in its entirety by both but divided between them and administered separately.

The foreign secretaries of both nations are scheduled to meet in January. Masood Ahmad Khan, a former Pakistani diplomat, said Friday’s meeting suggests “a political will at the highest level and is, therefore, important, symbolically and substantively.”

The chairman of the opposition Pakistan People’s Party, Bilawal Bhutto Zardari, said in a tweet, “Constant engagement is the only way to resolve all outstanding issues.”

This is not the first time the Modi government has conducted stealth diplomacy. Earlier this month, the national security advisers of both countries met secretly in Bangkok, away from the media’s glare.

Some opposition leaders in India said Modi’s diplomacy should move beyond grandstanding and focus on tangible outcomes.

“It is utterly ridiculous. You do not conduct diplomacy at the apex level in such a cavalier manner,” said Manish Tewari, a senior leader of the Congress party. “The relationship between India and Pakistan is perhaps the most complex, convoluted and intricate relationship between two nuclear weapon states.”

A high-level meeting between the two neighbors was canceled earlier this year because of disagreements, and frequent firing across the border has led to a war of words.

“The prime minister over the last 18 months has done somersaults, cartwheels and U-turns in his entire engagement with Pakistan,” Tewari said, adding that Modi’s “adventure” has “serious implications on India’s national security.”

Khan reported from Peshawar, Pakistan.

Read more:

The divide between India and Pakistan is so deep you can see it from space

Modi makes a lot of overseas trips, but is he a diplomatic failure with India’s neighbors?

Report: Pakistan’s nuclear arsenal could become the world’s third-biggest