Border villagers play cards as they sit near a Indian post at Chandu Chak village of Ranbir Singh Pura sector near the India-Pakistan international border, about 35km from Jammu on February 28, 2019 in Jammu, India. Nitin Kanotra | Hindustan Times | Getty Images

India and Pakistan showed resolve and restraint this week as tensions flared between the nuclear-armed rivals but crucial underlying problems still need to be addressed, according to a former U.S. ambassador to Pakistan. Military planes from both sides carried out tit-for-tat air strikes this week in each other's territories while their troops traded fire along the de facto border in Kashmir. The escalation was triggered after terror group Jaish-e-Mohammed claimed responsibility for an attack in India-controlled Kashmir on Feb. 14 that killed more than 40 Indian security officers. New Delhi and Islamabad also claimed to have brought down each other's military jets and Pakistan announced an Indian pilot was captured into its custody. On Thursday, Pakistani Prime Minister Imran Khan announced that as a "peace gesture," he would release the pilot, Abhinandan Varthaman, as early as Friday. The move was welcomed by the chiefs of India's three armed forces during a joint press conference Thursday evening — but they would not say if New Delhi considered the return a de-escalation in the conflict.

It's not every day that America and Iran, for example, stand shoulder-to-shoulder, criticizing the Pakistanis for not cracking down on terrorist groups. Cameron Munter former U.S. ambassador to Pakistan

Still, Thursday's developments prompted many to hope that both countries will stop the situation from spinning out of control, especially into a full-blown armed conflict. "I think both leaders had to show two things: Each of them had to show resolve, and each of them, fortunately, showed restraint. That is to say both sides said that they would not be pushed around by the other," Cameron Munter, CEO and president at the EastWest Institute, told CNBC's "Squawk Box" on Friday. Munter was also the former U.S. ambassador to Pakistan between 2010 and 2012. Both sides have presented conflicting information from Tuesday's incident: A senior Indian government official source told Reuters that 300 militants were killed, but Pakistan said there were no deaths from India's bombing. Munter, who said India's air strike inside Pakistan did not lead to any casualties, pointed out it was a sign of restraint on New Delhi's part. "And the restraint on the Pakistani side was not to gloat but to actually come up with Imran Khan's suggestion to turn back the pilot," he added.

The Kashmir problem

India and Pakistan's conflict over the mountainous region of Kashmir dates back to 1947 when both countries became independent from British colonial rule. The entire subcontinent was partitioned into Hindu-majority India and Muslim-majority Pakistan, which led to a mass displacement as people migrated from one country to the other. Outbreaks of communal and religious violence killed hundreds of thousands of people in the subcontinent during that time.

The Srinagar-Leh highway that connects Kashmir with the Indian region of Ladakh. The average snow buildup in the rocky territory normally stays in the level of 15 to 25 meters. Closed for a half of each year, the highway usually opens up in late spring and travelers on the pass have to deal with snowstorms, fierce air currents, and dangerous circumstances. Yawar Nazir / Getty Images

Jammu and Kashmir was a former princely state where a large number of people were killed and others were driven away by the violence during the partition. Since then, India and Pakistan have fought multiple wars over the region — both countries claim the region in full but control only parts of it. Many have raised concerns over violence and human rights abuses in both India-controlled Jammu and Kashmir, as well as in Pakistan-controlled Azad Kashmir and Gilgit-Baltistan region. Speaking about India-controlled Kashmir, Munter said: "You have a mainly Muslim population and you have many hundreds of thousands of Indian troops keeping order. That's really not a sustainable or good situation." "It's not something that Indians want other people to interfere with but until that gets solved, there's going to be a problem in Kashmir," he added. In a recent op-ed piece with Indian newspaper Business Standard, former Indian foreign secretary Shyam Saran said that after the Feb. 14 terror attack, India must examine why so many locals get recruited by terrorist groups operating in the area. "There have been allegations of intelligence failure but the ability to stop terrorist incidents and apprehending terrorists is most effective if the local populace is ready to provide intelligence that is relatively specific," Saran wrote. "This is possible only if there is a high level of trust and confidence between the populace and the security forces." Pakistan's problem, according to Munter, is that no one believes they've cracked down on the groups like the Lashkar-e-Taiba — which carried out one of the worst terrorist attacks in India's history — or the Jaish-e-Mohammed, which operate in that region. India has long accused Pakistan of supporting those groups. "Until the Pakistanis are credible in cracking down on these groups, they're going to have a problem. Because it's not every day that America and Iran, for example, stand shoulder-to-shoulder, criticizing the Pakistanis for not cracking down on terrorist groups," the former envoy said.

Test of leadership

Political analysts agreed that this week's confrontation between India and Pakistan was a test of leadership for both Khan and Indian Prime Minister Narendra Modi, who is facing a parliamentary elections in the coming months. The developments did not turn out well for Modi, according to Moeed Yusuf, associate vice president for the Asia Center at the United States Institute of Peace.

Pakistani Prime Minister Imran Khan addresses his nation on July 26, 2018. Muhhamad Reza | Anadolu Agency | Getty Images