The kidnapping of 276 schoolgirls in 2014 triggered international outrage that created the #bringbackourgirls Twitter campaign.
The Boko Haram militant group handed over 21 abducted Chibok girls to the Nigerian government in a prisoner swap, the Nigerian president's office announced on Thursday.
The group kidnapped 276 girls from their school in the town of Chibok town in the northern Borno state in April 2014, triggering international outrage that created the #bringbackourgirls Twitter campaign.
"The release of the girls is the outcome of negotiations between the administration and the Boko Haram brokered by the International Red Cross and the Swiss government," a presidency statement said.
"The negotiations will continue," it added.
The statement gave no details on the swap deal, but local media sources said the girls were exchanged for four militants.
Muhammadu Buhari Buhari was elected as the president of Nigeria in 2015 after promising to defeat Boko Haram. The Nigerian army and its foreign allies have pushed the group back to its stronghold in the northeast's vast Sambisa forests in the past few months.
But Buhari has faced criticism from human rights activists and parents of the abductees for failing to find the girls.
Last month, he urged the United Nations to help with negotiating an exchange of the girls in return for the release of detained Boko Haram leaders.
As I depart Abuja for Germany on an Official Visit, I welcome the release of 21 of our Chibok Girls, following successful negotiations.— Muhammadu Buhari (@MBuhari) October 13, 2016
According to the government, authorities secured the girls' release three times in the past. But their efforts failed to bear fruit due to splits within the ranks of Boko Haram.
In August, the Daesh terrorist organisation announced that the leader of Boko Haram, with which it is affiliated, had been replaced by Abu Musab al Barnawi.
However, the group's former leader, Abubakar Shekau, denied this, insisting that he is still in charge.