Observers say the governments will need to negotiate a peace agreement, despite a slew of failed talks.
Tension is high between Pakistan and Afghanistan after Pakistan's military air raids into Afghanistan killed 47 civilians over the weekend. During the past few months, Tehreek-e-Taliban Pakistan (TTP), an armed militant group, increased attacks on Pakistan security forces from sanctuaries inside Afghanistan.
Afghan officials said the death toll had risen to 47 following Pakistan military strikes in the eastern Afghanistan provinces of Kunar and Khost. The casualties include mostly women and children.
Taliban officials in Kabul and Islamabad are struggling to resolve the cross-border attacks, and have warned Islamabad after the death of civilians in the predawn assault.
Last year, Pakistan's government involved the Taliban in negotiating a peace agreement with the TTP, but that failed just after a monthlong truce between Islamabad and the TTP. The Taliban, meanwhile, have not made significant efforts to help Islamabad break a deal with the TTP to stop them from attacking Pakistan.
"The Islamic Emirate of Afghanistan condemns in the strongest possible terms the bombardment and attack that has taken place from the Pakistan side on the soil of Afghanistan," government spokesman Zabihullah Mujahid told journalists in an audio message.
'Paving the way for enmity'
"This is cruelty, and it is paving the way for enmity between Afghanistan and Pakistan. We are using all options to prevent repetitions of such attacks and calling for our sovereignty to be respected," Mujahid said.
"Any retaliatory attack from the air, as experienced last week, need not target innocent civilians, whether locals or refugees. Such incidents will not only kill trust but will also lead to more militancy," Omar Samad, a senior fellow at the Atlantic Council and former Afghan Ambassador to France and Canada, told DW.
After the incident, hundreds of civilians in Khost took to the streets and chanted anti-Pakistan slogans.
"Pakistan is learning the hard way that their hard-line ideology means more to the Taliban than gratitude for years of support and acquiescence from Pakistan," Husain Haqqani, the director for South and Central Asia at the Hudson Institute and former Pakistani ambassador to the United States, told DW.
The Taliban summoned Pakistan's ambassador in Kabul on Saturday and registered their protest against the military airstrikes inside Afghanistan. Afghan officials claimed that most of the civilians were killed when a Pakistani jet entered inside Afghanistan. Pakistan denied the claim of carrying out airstrikes.
The United Nations Assistance Mission in Afghanistan (UNAMA) showed concern about the civilian deaths.
"UNAMA is deeply concerned by reports of civilian casualties, including women and children, as a result of airstrikes in Khost & Kunar provinces," the mission wrote on Twitter, adding that officials were working to establish the facts and verify losses.
Cross-border attacks
An increasing number of attacks on Pakistan's army from the TTP are being carried out over the border. Seven Pakistani soldiers were killed in an ambush by the militant group near the Afghan border on Thursday.
Pakistan's Foreign Ministry said in a statement on Sunday: "In the last few days, incidents along the Pak-Afghan border have significantly increased, wherein, Pakistani security forces are being targeted from across the border." It added that the attacks were being carried out "with impunity" and that Islamabad had repeatedly asked Afghan authorities to act to stop them, to no avail.
The soldiers were killed in North Waziristan, which borders Khost, where the airstrikes are reported to have taken place. Pakistan's military on Thursday said that 128 armed militants had been killed near the border area with Afghanistan since January. Meanwhile, they claimed that 100 soldiers have been killed by militants during the same period.
"Although Pakistan wants cooperative relations with Kabul, ties may become testy in the future. This is because of Islamabad's rising concern over the surge of cross-border terror attacks since the Taliban assumed power. Hopes that a Taliban government would help Pakistan secure its western border have not materialized. TTP Pakistan continues to be based in Afghanistan and conduct attacks from there," Maleeha Lodhi, Pakistan's former ambassador to the UN, US and UK, told DW.
"Afghanistan went through an agonizing regime collapse and change in eight months, while Pakistan experienced a political turnover a few days ago. It will take a bit of time for both sides to recalibrate and reset policies impacting bilateral relations that are influenced by regional and great power rivalries. Both Kabul and Islamabad have options to escalate or defuse tensions. A mix of internal and external factors will determine the new path," said Samad.
"The Taliban need Pakistan and will try to find a way of balancing their need for good relations against their ideological affinity with the TTP. Pakistan seems willing to use force against the TTP inside Afghanistan if the Taliban cannot deliver a deal between them and Pakistan's government," Husain said.
What are the reasons behind the strained ties?
Analysts believe there are multiple historic reasons and disputes that lead to strained ties and border clashes between the two countries.
"Contrary to biased predictions, cross-border attacks have not stopped or been brought under control. Part is provoked by tribal reactions to border management policies to block passage. Others have to do with security risks and militancy challenges in the form of groups such as the TTP or groups crossing into Afghanistan. The third reason has to do with control of smuggling and illegal activities benefiting a variety of actors," Samad told DW.
Lodhi said: "The border fencing issue is another source of unsettled discord. Strong words were exchanged between officials of the two countries, with Pakistan's Foreign Ministry warning Kabul against harboring terrorists for using Afghan soil with impunity to carry out activities inside Pakistan."
Haqqani said: "Pakistan will continue to suffer blowback from its policy of supporting extremists in Afghanistan."
"Pakistan and Afghanistan need to figure out how to live as neighbors, without either side supporting armed groups operating on each other's soil. That might not be easy under the Taliban," Haqqani said.
"Both sides need to do more without stepping on each other's toes," Samad said. "The fact that the Taliban have squandered several opportunities to build consensus and an inclusive government thus far, and that Pakistan may have overplayed its hand with unrealistic expectations, means that there is a need for recalibration and renewed engagement to seek a constructive middle ground."
From Deutsche Welle Newsfeed