Weeks of deadly cross-border shelling from Pakistan and militant attacks from Afghanistan are threatening a fragile thaw between the long-wary nations, raising alarm on both sides about the potential for expanded regional conflict as the U.S. presence in Afghanistan shrinks.

Afghan officials allege that the Pakistani military recently launched more than 450 rocket and artillery strikes on two eastern Afghan provinces, killing as many as 40 civilians. Pakistani authorities say six cross-frontier assaults by insurgents based in those provinces have killed least 55 Pakistani security personnel.

Officials on both sides say the attacks portend the dangers of a U.S. military drawdown, particularly along a poorly secured border where militant groups are cooperating to expand their territories.

On Monday, hundreds of Afghans took to the streets to protest Pakistan’s cross-border shelling, with peaceful demonstrations in Lashkar Gah in the south and Jalalabad in the east.

About 700 people, including students and religious leaders, turned out in Lashkar Gah, chanting “down with Pakistan” and offering condolences to the families of those who have died. The provincial governor planned to donate one month’s salary to the residents displaced by the artillery, and local businessmen pledged money as well, said a provincial spokesman, Dawood Ahmadi.

The border section along northeastern Konar and Nangahar provinces has long been among Afghanistan’s least-patrolled, making it fertile ground for insurgents, and U.S. military officials said they do not have a clear understanding of the violence or the motives behind it. Some Western officials said Afghanistan and Pakistan may be stoking the tensions in a bid to wrest concessions from U.S. benefactors — or to exert power over the long-disputed border and beyond.

Pakistani, Afghan and U.S. military representatives met Thursday in Pakistan, the latest in a series of high-level discussions on the topic, and officials on all sides said they were hopeful that a recent improvement in ties between Pakistan and Afghanistan would keep the situation from escalating. Afghan President Hamid Karzai said his troops would not respond to the shelling from Pakistan, which Islamabad says has been minimal and aimed only at fleeing militants.

But strains persist. Afghan officials said shelling from Pakistan continued even after its army chief, Gen. Ashfaq Kayani, assured the Afghan ambassador in a meeting last week that it would stop. Members of the Afghan parliament called on Karzai to break with Islamabad over the shelling.

Pakistani Prime Minister Yousaf Raza Gillani telephoned Karzai on Wednesday to insist that Pakistan has “shown utmost restraint” and to push for the situation “to be defused quickly,” according to a government statement. Dawn, a top Pakistani newspaper, accused Afghanistan of not acting against “a new theatre of war that is spiralling out of control.”

Claims and counterclaims

The border tensions come as long-fraught relations between the two countries had appeared to be warming. The strains also coincide with a new round of talks between U.S. officials and an insurgent official said to be close to Taliban leader Mohammad Omar. Afghans contend that Pakistan seeks to undermine the talks because it wants to control them. Pakistan denies the assertion.

In a telephone interview Sunday, Konar’s governor, Sayed Fazlullah Wahidi, accused Pakistan of attempting to disrupt the already fitful peace process in Afghanistan by “confusing [the Taliban] and making them worry about coming over and laying down their arms.”

The timing of the accusations could have political benefits for both countries. Afghanistan is negotiating a strategic partnership with the United States that would outline the two nations’ relationship after 2014. Afghanistan has demanded weaponry such as fighter jets and tanks, both of which U.S. officials think the young Afghan army does not need; the cross-border violence could bolster Afghanistan’s claims that it is under threat from neighbors.

Pakistan, meanwhile, is facing cuts in military aid from U.S. lawmakers fuming over the discovery of Osama bin Laden there, and its army has deep concerns about a militant backlash as Americans draw down.

It is nearly impossible to verify what has occurred along the mountainous and remote border section in question, which abuts far northwestern Pakistan. NATO forces have little presence on the Afghan side, and Pakistan’s army has few troops on its side. The span is largely monitored by weak police forces, as well as by tribal militias in Pakistan.

Afghan officials said the Pakistani military began firing mortar rounds, rockets and other heavy artillery across the frontier in late March. Afghan security officials in those areas say they have documented deaths and injuries to scores of civilians, including children. The Konar police chief, in a June 23 letter to the Interior Ministry’s human rights department, called the strikes “a clear violation of human rights” by the Pakistani military.

Pakistan says groups of about 300 armed militants have charged on six occasions from Afghan hideouts into Pakistan, most recently Wednesday. Civilians have also been abducted and killed and buildings set aflame, said an army spokesman, Maj. Gen. Athar Abbas. He said that Pakistani forces’ response to such attacks “may have resulted accidentally in some rounds falling on the other side” but that the Afghan claims are “highly exaggerated.”

Rahimullah Yousafzai, an editor with the Pakistani daily the News who is an authority on the area’s militant groups, said such shelling would fit a pattern. “Pakistani forces just fire indiscriminately from wherever they’re attacked. They also kill civilians here in Pakistan,” he said, referring to similar assertions by residents of areas where the army has battled insurgents.

In its defense, the Pakistani military has stepped up criticism of Afghan forces and the U.S.-led NATO coalition, which it says jeopardized Pakistani military gains along the border by inadequately guarding the Afghan side. Pakistani officials said the attackers are mostly Pakistani Taliban fighters who were expelled by army offensives but easily found shelter among their Afghan brethren — a reversal of long-standing U.S. complaints that Pakistan has allowed the Afghan Taliban sanctuary in its lawless border belt.

U.S. military officials acknowledge that Pakistani Taliban fighters have found refuge in eastern Afghanistan’s mountains. Some Pakistani officials suggest that Afghanistan is encouraging the militant sieges to stoke problems.

“What more can we do?” said a Pakistani military official, who said Afghan officials have rejected Pakistani suggestions to fence or mine the border. “They should accept their responsibility and not always press us for more.”

Pakistani Taliban spokesmen, in statements and interviews, have asserted responsibility for the attacks, which they call retaliation for past army operations. Some said a small number of Afghan fighters also have participated.

Unevenly matched armies

Some observers say that no matter the scale, the shelling amounts to a blunt display of aggression by Pakistan’s army — a force that has been unable to contain a fierce domestic insurgency but that remains far stronger than its nascent Afghan counterpart. One senior Afghan official, who is close to Karzai and who spoke on the condition of anonymity to discuss the sensitive issue, said he thought Pakistan seeks to provoke and show its might to the United States as the two nations’ alliance frays in the wake of bin Laden’s killing.

Nader Khan Katawazi, an Afghan parliament member from the east, said Pakistan “wants to show the world that it still has the power to control Afghanistan after the foreign troops leave.”

The senior Afghan official said Karzai, who regularly condemns NATO troops for civilian casualties, has shown restraint because he realizes the weak Afghan army cannot seriously confront Pakistan.

Against the backdrop, some analysts said, they fear militants on both sides are working together more closely and increasing their territory along the border region. Bilateral disputes will only benefit them, Yousafzai said.

“Those areas have now become a problem — they are now being used by the militants on both sides,” he said, referring to regions where military presence is light or which have been vacated by U.S. troops, including parts of Konar. “This problem is going to become even more acute as NATO forces withdraw.”

Special correspondents Sayed Salahuddin and Javed Hamdard in Kabul and Haq Nawaz Khan in Peshawar, Pakistan, contributed to this report.