Nigerian government troops have surrounded the area where gunmen are believed to be holding schoolchildren hostage in north-western Katsina state.

It is not clear how many students were abducted, and how many ran away during the attack and has not yet been found.

About 800 pupils were enrolled at the all-boys school and about half remain unaccounted for.

The attackers are thought to be seeking ransom, an aide to President Muhammadu Buhari has said, the government has blamed the attack on bandits, a loose term for gangs operating in the area.

Amnesty International says more than 1,100 people were killed by bandits in northern Nigeria in the first six months of this year, with the government failing to bring the attackers to justice.

BBC Nigeria correspondent Mayeni Jones says there is growing concern about insecurity across Nigeria.

The north-west was affected by kidnappings for ransom, the north-east by an insurgency by militant Islamists, and the south by attacks on oil facilities by groups demanding a greater share of oil revenue for the region, she adds.

Parents have gathered at the school in the Kankara area, pleading with the authorities to help find their children, News agency reported.

Abubakar Lawal was quoted as saying that two of his three sons at the school, known as the Government Science Secondary School, were missing.

More than 300 children are reportedly still missing, according to an official from the state.

Osama Aminu Maale, a student who escaped the abductors and returned to his parents, told the AFP news agency that hundreds of students had been taken.

“After they took us away we stopped inside the bus where they made the older students take a headcount. We counted 520,” the 18-year-old student said.

The hostages were then split into groups before Mr Maale and four others escaped.

“One of the gunmen hit me repeatedly when I failed to keep up with the rest of the group due to my failing health before he let me trail behind, giving me the chance to escape,” he said.

On Saturday, the military said it had located the gunmen’s hideout in a forest and had exchanged gunfire with them.

In an interview, Garba Shehu, the president’s spokesman, said there was a “massive deployment” of troops to rescue the abducted children.

“Military commanders on the ground have the coordinates of where they believe the bandits are, and whoever they are holding. They have surrounded all of that area,” he added.

President Buhari comes from the state, and is currently there on a private visit.

He was being briefed hourly on efforts to rescue the children, Mr Shehu said.

“The criminal elements, bandits, will be crushed. They will be eliminated,” he added.

The children believe that 10 of their schoolmates were taken by the bandits, but this still needed to be verified, Mr Shehu added.

School authorities are speaking to parents to establish how many students have returned home and how many others could still be scattered across a large area after fleeing the attack

Residents living near the school told the BBC they heard gunfire at about 23:00 (22:00 GMT) on Friday, and that the attack lasted for more than an hour.

Security personnel at the school managed to repel some of the attackers before police reinforcements arrived, officials said.

Police said that during an exchange of fire, some of the gunmen were forced to retreat. Students were able to scale the fence of the school and run to safety, they said.

Several local residents joined the police in searching for the students, while many parents said they had withdrawn their children from the school.

“The school is deserted, all the students have vacated,” one witness, Nura Abdullahi, told AFP news agency.

The governor of Katsina, Aminu Bello Massari, ordered the immediate closure of all boarding schools in the state.