After being released to Nigerian security forces in the forests of Zamfara state, 344 boys were sent safely home to neighboring Katsina state, where they will undergo medical examinations before being reunited with their families, according to Katsina state Gov. Aminu Bello Masari.
"At the moment, 344 of the students have been handed over to security agents," Masari announced Thursday night on Nigeria's state broadcaster. "I think we have recovered most of the boys, if not all of them."
Masari said no ransom was paid and that the children's freedom was secured through negotiations.
Nigerian President Muhammadu Buhari commended what he called the "spirit of partnership and the collaborative efforts of the government of Katsina, Zamfara and military leading to the release."
"The Governor, Aminu Bello Masari, and the army worked extremely hard," Buhari said in a statement late Thursday. "As soon as I got the information I congratulated them. The Armed Forces know their job. They have been well trained and properly motivated."
The children are among more than 800 students enrolled at Government Science Secondary School, an all-boys boarding school in the rural town of Kankara in Katsina state. Gunmen stormed the school grounds in the middle of the night on Dec. 11 and kidnapped hundreds of students.
It was believed in the aftermath of the attack that more than 330 students were missing, but it is still unclear exactly how many boys were taken, how many others who fled have not yet been found and how many are still being held.
A poorly filmed video released Thursday that bore Boko Haram's logo allegedly shows some of the abducted schoolboys under trees. In the clip, one of the boys, who appears visibly distressed, speaks to the camera and pleads with the Nigerian government to answer the demands of their captors. He says some of his classmates were killed.
A voice in the video claiming to be Abubakar Shekau, a leader of one of Boko Haram's factions, says his group carried out the raid on the school because they believe Western education is "un-Islamic."
However, the Katsina state governor insisted Thursday that bandits were responsible for the kidnapping, "not Boko Haram." ABC News has not been able to independently verify this.
Boko Haram, whose name in the local Hausa language roughly translates to "Western education is forbidden," has waged a brutal insurgency in northeastern Nigeria since 2009, but has not previously claimed responsibility for attacks in the northwest. The group seeks to establish an Islamic state in northeastern Nigeria, though it has spread its terror across the region's mountainous borders over the years into Niger, Chad and Cameroon, all of which surround the Lake Chad Basin, where millions have been affected by the violence, according to the United Nations.
Boko Haram has been targeting Nigerian schools for a number of years. One of the most well-known attacks happened in April 2014, when Boko Haram fighters abducted 276 girls from their dormitory at a boarding school in Chibok, a town in northeastern Nigeria's Borno state. Some of the girls managed to escape on their own, while others were later rescued or freed following negotiations. But the fate of dozens remains unknown.
Under Shekau's leadership, Boko Haram pledged allegiance to ISIS in 2015. Shekau and several commanders split from the group in 2016 over ideological differences and formed their own faction.