PESHAWAR, Pakistan – Teams of Taliban fighters crossed the Afghan border Saturday and attacked security checkpoints in a previously peaceful region of northwestern Pakistan, killing more than two dozen soldiers and police, Pakistani officials said.

Pakistan has blamed Afghan and NATO forces for not doing enough to stop such cross-border attacks, which could become worse as the U.S. withdraws troops from Afghanistan. The area where Pakistan said Saturday’s attack originated has largely been abandoned by the U.S. in recent years.

Afghan officials denied that the militants came from their side of the border. The Afghan government has long said the center of the Taliban insurgency is in Pakistan and has joined the U.S. in criticizing Islamabad for failing to stem the flow of militants into Afghanistan.

At least 200 militants crossed into Chitral district Saturday morning and attacked seven checkpoints run by the paramilitary Frontier Corps, two of which were overrun, the Pakistani military said.

The scenic mountainous region has rarely experienced militant violence and is a popular destination for foreigners and locals seeking relief from the searing summer sun.

There were conflicting reports about the numbers of Pakistani security forces and militants killed in the attack.

The Pakistani military said 25 paramilitary soldiers and police and 20 militants were killed in the fighting. But local police official Nizam Khan said 38 soldiers and police died along with nine militants.

Fighting was still ongoing Saturday afternoon, as Pakistan sent in reinforcements to drive the militants back across the border, the military said.

The militants chanted “God is great!” and “Long live jihad!” as they fought, said Capt. Abdul Ghani, a member of the paramilitary forces.

The military blamed the attack on Pakistani Taliban fighters and their Afghan allies who have taken sanctuary in the Afghan districts of Nuristan and Kunar across the border from Chitral to escape Pakistani army offensives. The U.S. largely pulled out of both districts in recent years.

Maj. Mohammad Ayub Hassainkhail, deputy border police commander in eastern Afghanistan, denied the attack came from his side of the border.

“We have officers all along the border area and we haven’t seen any movement of the insurgents across the border,” said Hassainkhail.

Gen. Shams Ul-Rahman Zahid, the provincial police chief in Nuristan, said Pakistani Taliban fighters have operated in the province. But he claimed pressure from Afghan and NATO forces forced them to go back to Pakistan.

NATO did not immediately respond to requests for comment.

The Pakistani military said it has given Afghan and NATO forces intelligence about large pockets of militants in Kunar and Nuristan over the last year, but they have not taken sufficient action.

In the absence of NATO and Afghan army forces along the border, “the terrorists are using these areas as safe havens and have mounted repeated attacks against … security forces posts and isolated villages,” the military said in a written statement.

Pakistan complained earlier this summer that militants coming from Afghanistan killed at least 55 members of the security forces and tribal police in a spate of attacks, and demanded that U.S. and Afghan forces do more to stem the flow of fighters.

A senior Western intelligence official expressed doubt at the time about Pakistan’s figures and whether all the attacks came from bases in Afghanistan. The official spoke on condition of anonymity in order to discuss intelligence matters.

Amid the border conflict earlier this summer, the Afghan government complained that Pakistan fired more than 750 rockets into eastern Afghanistan that killed at least 40 people.

The Pakistan army denied it intentionally fired rockets into Afghanistan, but acknowledged that several rounds fired at militants conducting cross-border attacks may have landed over the border.

Kabul and Washington have long accused Pakistan of not doing enough to stop Afghan Taliban militants from using its territory to launch cross-border attacks against troops in Afghanistan.

The Pakistani military claims its forces are already stretched too thin by operations against the Pakistani Taliban, who have declared war against the state. The Afghan Taliban and their allies have largely confined their fight to Afghanistan and are seen as less of a threat by Pakistan. Pakistan also has historical ties to the Afghan Taliban, and many analysts believe the government sees them as key allies once foreign troops withdraw from Afghanistan.

Elsewhere in northwest Pakistan on Saturday, gunmen kidnapped and killed a retired army colonel in the city of Kohat, and a police officer died trying to rescue him, said police official Umer Hayat.