Islamabad, Pakistan (CNN) -- More than 200 Afghan militants crossed over and attacked a security checkpoint in northwest Pakistan, sparking a firefight that left dozens dead, authorities said Thursday.
The firefight in Upper Dir district along the Afghan border erupted Wednesday morning and went on for about a day, said Ghulam Muhammad, a government official in the district.
Militants used mortars and short-range rockets, said senior police official Qazi Jamil.
Six civilians and 28 security forces died in the attack, he said, adding that Pakistani military officials took over and used a helicopter gunship, killing some 45 militants.
Afghan militants have support from their Pakistani counterparts, who provide them with shelter and ammunition, said Qazi Jamil, a senior police official in Khyber Pakhtunkhwa province.
Muhammad had earlier said that the attackers were from Pakistan, but a day later said they had entered from Afghanistan.
Most of the militants have gone back and major firefighting has stopped, but there is still some minor gunfire, he said.
"Militants came from Afghanistan, attacked on the check post, did their job and went back," Muhammad said.