Pakistan army said on Monday that majority among those present in a religious school were killed when the security forces bombed the seminary in a pre-dawn attack.
"Gunship helicopters targeted the madrassa which was being used for terrorist activities and to train militants in the Bajur tribal region," the military spokesman Major General Shaukat Sultan told a news conference.
Sultan said that 20 to 30 people were confirmed killed, but added that the locals have put the death toll at 80.
"There were 70 to 80 people at the madrassa when the security forces conducted the operation at 5 a.m.," the army spokesman said.
He said that some foreigners were among those killed in the strike on Chenagai village, 10 km north of Khar, the headquarters of the Bajur tribal region.
"The identity of the foreigner is being established," he said.
Sultan said that the government had warned the militants not to use seminary for terrorist training but they had refused to comply.
"Most of the targets were eliminated," the spokesman said. He said that there was no child or woman at the time of the attack.
The attack occurred two days after a huge anti-U.S. demonstration in Bajur, bordering Afghanistan's eastern Kunar province.
The demonstrators chanted slogans in favor of Osama bin Laden and Taliban's Mullah Muhammad Omar.
Siraj ul Haq, Senior Minister of North West Frontier Province and Haroon ur Rashid, Member of the National Assembly, resigned on Monday to protest the attack.
Haq and Rashid attended the funeral of those died in the attack and announced their resignations while speaking to thousands of the mourners.
"There is no need to sit in the parliament if we can not protect our people," the two men said, who belong to Jamaat-e- Islami party.
"The attack was launched after confirmed information was received that the inmates were involved in terrorist training," Sultan said.
He added that the seminary was being observed for few days.
"The operation was successful," he said.
A local private Aaj TV reported that the targeted madrassa was owned by a local leader of a banned group "Tanzeem Nifaz-e-Shariat- e-Muhammadi (TSNM)."
It is the second major attack on Bajur in less than a year.
In January the United States launched a missile strike on a village in the Bajur area in an effort to kill al-Qaeda's deputy leader Ayman al-Zawahiri.
The strike killed 18 people but Pakistani officials said that al-Zawahiri was not among the dead.
A jirga or council of tribal elders was planned to be held in Bajur Monday to sign a peace deal with the government but had to be cancelled following the attack, locals said.
The military spokesman said that the attack would not affect peace agreements with tribesmen.