Hundreds of Nigerian schoolgirls have been released days after gunmen stormed a village in the night and took them from their boarding school.
All 279 girls - students aged 12 to 17 from the Government Girls' Secondary School in the town of Jangebe - were freed, the governor of the northwestern Zamfara state said.
Earlier reports had stated over 300 girls had been taken, but governor Bello Matawalle said some had run into the bush to hide from the assailants.
"I join the affected families and the people of Zamfara state in welcoming and celebrating the release of the abducted students of GGSS Jangebe. This news brings overwhelming joy. I am pleased that their ordeal has come to a happy end without any incident," Nigeria's president, Muhammadu Buhari, tweeted.
"We are working hard to bring an end to these grim and heartbreaking incidents of kidnapping. The Military and the Police will continue to go after kidnappers. They need the support of local communities," he added.
Mr Buhari has been under heavy criticism for an increase in attacks and school kidnappings for ransom. He was elected in 2015 on a promise to resolve the country's security failures.
Mr Matawalle said no ransom had been paid and "repentant bandits' going through a government amnesty programme had helped secure the release.
A dozen girls were sent to hospital, according to Reuters reporters in the state capital Gusau, where the pupils were reunited with their parents.
"They started hitting us with guns so that we could move," Farida Lawali, 15, said about her ordeal as the girls were taken into a forest by the kidnappers. "While they were beating them with guns, some of them were crying and moving at the same time."
A surge in armed violence in the northwest of Nigeria has led to a deteriorating security situation in Africa's most populous country. In December, bandits in Katsina - which borders Zamfara state - kidnapped at least 300 schoolboys.
The abduction on Friday was the second in a week in the region, after at least 40 people, including 27 students, were abducted in a similar raid on a state school in Niger state, 300 miles south of Zamfara. The teenage boys were released on Saturday.
Following the incidents, the Nigeria Union of Teachers and the National Association of Nigerian Students, said it was prepared to close down schools, as students and teachers were no longer safe.
Nnamdi Obasi, senior adviser for Nigeria at the International Crisis Group, said: "Nigerian governments typically deny paying ransom to kidnappers and President Buhari ruled out that option categorically, last week.
"But it’s unlikely the armed groups would spend their time, resources and energies carrying out these raids, and then let their captives go again and again, without extracting some cash, negotiating the release of some of their members held by security agencies or gaining some other concessions, in return".
Islamist group Boko Haram have previously claimed responsibility for school kidnappings, but no group had claimed the latest attack.