Nigeria-based Islamist militant group Boko Haram has said it was behind last week's kidnapping of hundreds of schoolboys in the north-western Nigerian state of Katsina.
More than 300 pupils are unaccounted for, but others managed to escape.
The authorities had previously blamed "bandits" for the attack.
Boko Haram has been notorious over the last decade for school kidnappings, including in Chibok in 2014, but these have taken place in the north-east.
In an audio message about the abductions, its leader Abubakar Shekau said "what happened in Katsina was our responsibility" and that his group opposed Western education.
This year hundreds of people in Nigeria's north-west region have been killed in attacks by what authorities have called criminal gangs, but until now it has been unclear whether they had links with Boko Haram.
The militant group has waged a brutal insurgency since 2009, mostly in north-eastern Nigeria. Tens of thousands of people have died and millions have been forced from their homes.
Activists have criticised President Muhammadu Buhari, whose home state is Katsina, of mishandling the security operation against the militants.
Some have accused him of not showing empathy to the victims and families there after a video shared online on Tuesday showed him visiting his farm.
"It's absolute incompetence and an uncaring, indifferent ruling class that does not understand what it means to govern," former Nigerian Education Minister Oby Ezekwesili told the BBC's Newsday programme.
"Here we are as a country just completely showing ourselves as completely unserious when it comes to the matter of human life especially that of our children, " she said, accusing the government of rebranding "terrorism as banditry".
Residents living near Government Science Secondary School in Kankara told the BBC they heard gunfire at about 23:00 (22:00 GMT) last week 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.
About 800 students were at the school when the attack happened and more than 300 are still missing - but it is not clear if all of them are being held by the kidnappers.
A 17-year-old boy who managed to escape the abductors told the BBC Hausa service how he crawled for several miles through the forest to freedom.
President Buhari who is currently in Katsina on a private visit was being briefed hourly on efforts to rescue the children, his spokesman Garba Shehu said.
The children believe that 10 of their schoolmates were taken by the bandits, but this still needed to be verified, Mr Shehu told the BBC.
He tweeted on Tuesday saying that Katsina Governor Aminu Bello Masari had met and briefed President Buhari about the operation to free the kidnapped students.
Many parents said they had withdrawn their children from the school, Governor Massari also ordered the immediate closure of all boarding schools in the state.
'A worrying security development'
Analysis by Ishaq Khalid, BBC News Abuja
Shekau's statement has sparked mixed reactions in Nigeria, with the authorities who blamed "bandits" for the attack now saying they were uncertain.
Months before last week's attack Boko Haram claimed that it had a presence in the north-west region, so if it is proved that they are indeed behind the school raid, it's a worrying development.
Some sceptics however say that Shekau may just be claiming responsibility as a propaganda strategy - to attract more attention to his group - which is competing for dominance and relevance with a splinter faction known as Islamic State West Africa Province
But as officials work on finding out who was behind the attack, it's yet another incident that has brought great anxiety to parents in the north-west region about the safety of their children in schools.
Nigeria is facing growing and disparate security challenges.
The public want more than tough words but an assurance that the government is on the offensive and not on the back foot.