Nigerian government forces have cordoned off an area in northwestern Katsina state where school children are believed to be being held hostage.
More than 300 children are still missing, a state official said.
About 800 students were enrolled in the all-boys school and half were not counted.
An aide to President Mohammed Buhari said the attackers were expecting a ransom.
The government has blamed the attack on the robbers, which is a loose word for gangs operating in the area.
Amnesty International says more than 1,100 people have been killed by bandits in northern Nigeria in the first six months of this year, and the government has failed to bring the perpetrators to justice.
BBC Nigeria correspondent Maini Jones says there is growing concern about insecurity across Nigeria.
He adds that the northwest has been hit by the rescue abductions, the northeast has been plagued by militant Islamist insurgency, and attacks on oil facilities in the south by groups seeking a greater share of oil revenues for the region.
Parents gathered at a school in the Kangaroo area and begged authorities to help locate their children, Reuters news agency reported.
Abubakar Laval was quoted as saying that two of his three sons were missing at the so-called government science high school.
‘Bandits Will Be Crush’
On Saturday, the military said it was holding a jungle of gunmen and exchanging fire with them.
In a BBC interview, the president’s spokeswoman Karba Shehu said he had “sent massive troops” to rescue the abducted children.
“Army commanders on the ground believe they are where the bandits are, and whoever they are they have surrounded the whole area,” he said.
President Buhari is from the state and is currently on a private visit.
He was briefed for hours on efforts to rescue the children, Mr Shehu said.
“Criminal elements, bandits will be crushed and they will be removed,” he added.
Mr Shehu added that the children believe that 10 of their schoolmates were taken by robbers, but this still needs to be verified.
School officials are talking to parents to establish how many students have returned home after fleeing the attack and how many more could be scattered over a large area.
Residents near the school told the BBC they heard gunfire at around 23:00 (22:00 GMT) on Friday and that the attack lasted more than an hour.
Authorities said security personnel at the school chased away some of the attackers before police reinforcements arrived.
During the firefight, police said some of the gunmen were forced to retreat. They said students were able to measure the school fence and run to safety.
You may be interested in:
Several locals joined police to search for students, and many parents said their children had been dropped out of school.
“The school was deserted and all the students were out,” Noora Abdullah, a witness, told AFP.
Katsina Governor Aminu Bello Mazari ordered the immediate closure of all boarding schools in the state.
“Infuriatingly humble social media ninja. Devoted travel junkie. Student. Avid internet lover.”