Terrorist “safe havens” are inside, not outside, Afghanistan, Pakistan told the United Nations Security Council (UNSC) on Wednesday.

"The resilience of the insurgency led by the Taliban cannot be explained away by convenient references to external 'safe havens' or 'support centres'," Ambassador Maleeha Lodhi, Pakistan's permanent representative to the UN, said during a debate on Afghanistan.

Relations between the two countries have turned sour since Afghan President Ashraf Ghani accused Pakistan of waging an 'undeclared war of aggression' against Afghanistan. Pakistan and Afghanistan have long accused each other of turning a blind eye to militants operating along their porous border.

Pakistan, Lodhi asserted at the UNSC, was committed not to allow its territory to be used for terrorism against other countries. Pakistan's Zarb-i-Azb and subsequent Raddul Fasaad military operations had succeeded in eliminating all terrorist and militant groups from its tribal territory bordering Afghanistan, she said.

She told the 15-member Council that Pakistan is “implementing border controls, including the fencing and monitoring of vulnerable sections of the Pakistan-Afghanistan border.”

Responding to critical remarks made by her Afghan counterpart during the debate, she said: “As a country that continues to host over two million Afghan refugees, Pakistan expects gratitude and not hostility from the Afghan government.”

The main thrust of Ambassdor Lodhi's arguments centred around the need for a negotiated end to the Afghan war. She said that it had been Pakistan's consistent position that peace could be restored only through a negotiated settlement between Kabul and the Tehrik-i-Taliban Afghanistan.

This, she pointed out, "has also long been the consensus of the international community,” noting that a negotiated peace was also backed by UN Secretary-General Antonio Guterres, who had recently visited Kabul.

“The promotion of a political settlement and the pursuit of a military solution in Afghanistan are mutually incompatible,” she said.

Continued reliance on a military option, or enhancing troop numbers without an accompanying political strategy, would only lead to more violence and bloodshed, Ambassador Lodhi told the Security Council.

“It would not yield a political settlement,” she added.

Stressing the need to find a negotiated solution, she said that Pakistan has done whatever it can to help facilitate such a negotiated settlement. She referred in this regard to the 2015 Murree talks and efforts under the Quadrilateral Coordination Group (QCG) framework. She also recalled Pakistan's engagement with the Heart of Asia conference, the International Contact Group, the Moscow Format, and, most recently, the Kabul process, among others.

However, she made it clear that while others could help by promoting a negotiated settlement, peace could only be negotiated when Afghan parties desired it and eschewed a military solution.

“Today, there is every reason for the Afghan parties and their friends to pursue the path of a negotiated peace. All of them face a common threat from ISIS and the terrorist groups affiliated with it,” Lodhi said.

The Tehreek-i-Taliban Pakistan (TTP) and Jamaat-ul-Ahrar attack Pakistan from their bases in Afghanistan, Lodhi alleged. Therefore, “there is no other country [like Pakistan] which will gain more from peace in Afghanistan,” Ambassador Lodhi added.

“We are confident that, whatever our differences in the past, in the end, the deep bonds of religion, culture, history and geography between Pakistan and Afghanistan will assert themselves and produce an era of peaceful and mutually beneficial cooperation between our nations," Lodhi concluded.

Earlier, in a scathing report, Special Representative of the Secretary-General Tadamichi Yamamoto had warned that the recent surge of violent attacks in Afghanistan could signal a much worse and more fragile period ahead.

He called for urgent action to strengthen stability, including through improving the government's credibility, and urged all parties to exercise restraint and avoid violence.

“The months since my last briefing have been unusually tense in Afghanistan,“ he said. “Without enhanced efforts by the National Unity Government to increase political inclusiveness, strengthen accountability, and improve the government's credibility, particularly in the security sector, we are likely to face more crises in an increasingly fragile environment,” Yamamoto added.

In his briefing to the Council, the senior UN official spoke of the emerging difference following the May 31 terrorist attack in Kabul and warned that violent extremist groups could try to exacerbate the divisions, especially along sectarian lines.

Urging all sides to exercise restraint and avoid violence, Yamamoto underscored the need to address the root cause of the issues and reminded national actors that efforts to build consensus and political stability are critical.

On his part, Afghan Ambassador Mahmoud Saikal said reversing the tide against terror was contingent on eliminating support centres beyond the country's borders that produced, nurtured and empowered terrorists operating in Afghanistan.