A roadside bomb killed 3 U.S. soldiers and flattened a girls' school in northwest Pakistan on Wednesday in an attack that drew attention to a little-publicized American military training mission in the Al Qaeda and Taliban heartland.

They were the first known U.S. military fatalities in Pakistan's lawless tribal regions near the Afghan border, and a major victory for militants who have been hit hard by a surge of U.S. missile strikes and a major Pakistani army offensive.

The blast also killed three schoolgirls and a Pakistani soldier who was traveling with the Americans. Two more U.S. soldiers were wounded, along with more than 70 other people, mostly students, officials said.

The attack took place in Lower Dir, which like much of the northwest is home to pockets of militants. The Pakistani army launched a major operation in Lower Dir and the nearby Swat Valley last year that succeeded in pushing the insurgents out, but isolated attacks have continued.

The Americans were traveling with Pakistani security officers in a five-car convoy that was hit by a roadside bomb close to the Koto Girls High School. The blast flattened much of the school, leaving books, bags and pens strewn in the rubble.

"What was the fault of these innocent students?" said Mohammed Dawood, a resident who helped police dig the injured from the debris.

The soldiers were in the region as part of a U.S. mission to train members of the paramilitary Frontier Corps, Pakistan's army and the U.S. Embassy said.

They were driving Wednesday to attend the inauguration of a girl's school which had been renovated with U.S. humanitarian assistance, the embassy said in a statement. The school that was badly damaged in the blast was not the one where the convoy was heading, security officials said.

The blast was detonated by remote control, police said. It was not clear whether the attackers knew the convoy was carrying soldiers.

The attack highlights the presence of U.S. troops on Pakistani soil at a time when anti-American sentiment is running high. U.S. and Pakistani authorities rarely talk about the American training program in the northwest out of fear it could generate a backlash.

In a statement, the U.S. Embassy said three American military personnel were killed and two were wounded in the attack.

Two Pakistani reporters traveling in same convoy as the Americans said Pakistani military guides referred to the foreigners traveling with them as journalists. Initial reports of the attack, which proved incorrect, said four foreign journalists had been killed.

Mohammad Israr Khan, who works for Khyber TV, said two of the foreigners were wearing civilian clothes, not uniforms or traditional Pakistani dress.

"When our convoy reached near a school in Shahi Koto, I heard a blast," Express TV reporter Amjad Ali Shah said. "Our driver lost control and something hit me and I fell unconscious."

A small contingent of U.S. troops have been training Pakistan's Frontier Corps since at least 2008, officials from both countries have said. The corps is a major force in the northwest, but they have long been under-equipped and under-trained, making them a feeble front line against militants.

The training program was never officially announced, a sign of the sensitivity for the Pakistani government of allowing U.S. troops on its territory. Frontier Corps officials have said the course includes classroom and field sessions. U.S. officials have said the program is a "train-the-trainer" program, and that the Americans are not carrying out operations.

Despite the presence of tens of thousands of U.S. forces in neighboring Afghanistan, Pakistan does not permit American troops to conduct military operations on its soil.

After the bombing, the bodies of three foreigners and two injured were flown by helicopter to Islamabad and then taken to the city's Al-Shifa hospital, said a doctor there who asked his name not be used citing the sensitivity of the case. One of the injured had minor head wounds and the other had multiple fractures.

Pakistani army and intelligence officers were present and did not allow visitors into the building.