Also on Wednesday, 18 people were killed in an attack in the Gwoza district of north-eastern Nigeria, local officials told the AP news agency.

Soldiers 'overpowered'

The BBC's correspondent in Lagos, Will Ross, says the Nigerian military's statement that most of the girls had escaped their captors contrasts sharply with other information available to the BBC, including the claims of parents of pupils at the school. They insist "many" of their children are still missing.

The raid on the boarding school is a great source of embarrassment for the Nigerian authorities who say their military campaign against the militants is succeeding, he adds.

Hours before the military issued its statement, the governor of Borno state Kashim Shettima said the vast majority of the girls were still missing and offered a reward of 50m naira ($308,000; £184,000) for information.

The air force, army, police, local defence units and volunteers have all been involved in the search for the schoolgirls.

UN Secretary General Ban Ki-moon condemned the "shocking" mass abduction and called for the girls' immediate release.

"The targeting of schools and schoolchildren is a grave violation of international humanitarian law," he said in a statement.

"Schools are, and must remain, safe places where children can learn and grow in peace."

The BBC's Hausa Service says Boko Haram has kidnapped civilians in the past - usually women to work as sex slaves.

Gunmen reportedly arrived at the school in Chibok, a remote area of Borno state, late on Tuesday, and ordered its teenage residents on to lorries.

A local politician said about 50 soldiers had been stationed near the school ahead of annual exams, but were apparently overpowered.

Local residents reported hearing explosions followed by gunfire.

"Many girls were abducted by the rampaging gunmen who stormed the school in a convoy of vehicles," local education official Emmanuel Sam told the AFP news agency.

The attackers are thought to be from the Islamist group, Boko Haram
After Abuja was hit by a bomb attack, fears are growing that the organisation may be widening its campaign

A girl who managed to escape and did not want to be named told the BBC that she and fellow students were sleeping when armed men burst into their hostel.

The girl said she and her schoolmates were taken away in a convoy, which had to slow down after some of the vehicles developed a fault, at which point 10 to 15 girls escaped.

"We ran into the bush and waited until daybreak before we went back home," she said.

Nigerian media reported that two members of the security forces had been killed, and residents said 170 houses were burnt down during the attack.

The militants know the terrain well and the military has had only limited success in previous efforts to dislodge them from their forest hide-outs.

This year, the group's fighters have killed more than 1,500 civilians in three states in north-east Nigeria, which are currently under emergency rule.

The government recently said that Boko Haram's activities were confined to that part of the country. However, bombings blamed on the group killed more than 70 people in the capital city of Abuja on Monday.