ISLAMABAD (Reuters) - The Pakistani and Indian prime ministers exchanged messages via Twitter on Thursday hoping for peace, after Narendra Modi returned to power in New Delhi in an election fought in the wake of confrontation between the nuclear-armed enemies.

BJP President Amit Shah and Indian Prime Minister Narendra Modi react after the election results in New Delhi, India, May 23, 2019. REUTERS/Adnan Abidi

With official data showing Modi’s Hindu nationalist Bharatiya Janata Party (BJP) on course to increase its majority in India’s parliament, Pakistani premier Imran Khan said he was ready to cooperate with the government as it resumed office.

“I congratulate Prime Minister Modi on the electoral victory of BJP and allies. Look forward to working with him for peace, progress and prosperity in South Asia,” Khan tweeted.

Shortly after a victory speech before thousands of supporters gathered outside the BJP’s headquarters on Thursday evening, Modi thanked Khan.

“I warmly express my gratitude for your good wishes. I have always given primacy to peace and development in our region,” he said in a tweet.

But in a possible warning to India, Pakistan earlier announced that it had conducted a training launch of a Shaheen II surface-to-surface ballistic missile, which it said is capable of delivering conventional and nuclear weapons at a range of up to 1,500 miles.

“Shaheen II is a highly capable missile which fully meets Pakistan’s strategic needs toward maintenance of deterrence stability in the region,” Pakistan’s military said in a statement that made no direct mention of its neighbor.

On Wednesday, Pakistani Foreign Minister Shah Mehmud Qureshi spoke briefly with his Indian counterpart, Sushma Swaraj, on the sidelines of a meeting of the Shanghai Cooperation Organization member states in the Kyrgyz capital, Bishkek.

“We never speak bitterly, we want to live like good neighbors and settle our outstanding issues through talks,” he said following the encounter, in which Swaraj presented him with a gift of sweets.

Slideshow ( 2 images )

There was no immediate reaction from the Indian Foreign Ministry on Khan’s offer to work with Modi toward peace.

The exchange follows months of tension between the two countries, which came close to war in February over the disputed region of Kashmir, which both sides have claimed since independence from Britain in 1947.

Following a suicide attack in Kashmir that killed 40 members of an Indian paramilitary police force in February, Indian jets launched a raid inside Pakistan, striking what New Delhi said was a training camp of Jaish-e Mohammed, the radical group that claimed the Kashmir attack.

In response, Pakistan conducted a retaliatory strike of its own and jets from the two countries fought a dogfight in the skies over Kashmir during which an Indian pilot was shot down and captured.

Amid international pressure to end the conflict, Pakistan returned the pilot and there were no further strikes but tensions remained high, with regular exchanges of artillery fire from both sides in Kashmir.

Pakistan has also kept part of its airspace closed to international air traffic, disrupting flights to India and other parts of the region.

On Thursday, a Pakistani foreign ministry spokesman said the Kashmir dispute could only be resolved through implementation of U.N. Security Council resolutions that call for an end to hostilities and a plebiscite in the region.

“Dialogue is hence essential. We remain committed to the same, irrespective of whoever forms the new government in India,” he told reporters in Islamabad.

Khan has repeatedly offered to start talks with India to resolve the Kashmir issue, which has been the cause of two of three wars between the countries, and officials have said that they hoped the process could start once the election is concluded.

Last month he said he believed there was more prospect of peace talks with Indian if the BJP won the election.