The abduction of 276 schoolgirls in April 2014 brought international condemnation of Boko Haram

Receive the latest national-international updates in your inbox

File photo: A woman holds a sign as other protesters gather outside Nigeria House to mark the one year anniversary since a group of Nigerian schoolgirls were abducted on April 14, 2015, in London, England.

Twenty-one of Nigeria's Chibok schoolgirls kidnapped by Boko Haram more than two years ago have been freed in a swap for detained leaders of the Islamic extremist group, the government and military said Thursday.

Some 197 girls remain captive, though it is not known how many of them may have died.

The freed girls, the first to be released as a result of government action, are in the custody of the Department of State Services, Nigeria's secret intelligence agency, according to presidential spokesman Garba Shehu.

The government "wants the girls to have some rest, with all of them very tired coming out of the process," Shehu said.

All but three of the schoolgirls were carrying babies, an aid worker who saw the girls in Maiduguri told The Associated Press. He spoke on condition of anonymity because he was not authorized to speak to the press. Many Boko Haram captives recently freed by military action have been shunned by their communities because they have come home pregnant or with babies from the fighters.

Their release was negotiated between the government and Boko Haram with the International Committee of the Red Cross and the Swiss government acted as intermediaries, said Shehu and a statement from the ICRC. Negotiations will continue for the release of the other students, said Shehu.

Four detained Boko Haram leaders were released Wednesday night in Banki, a town on the northeast border with Cameroon, said a military officer familiar with the talks who spoke on condition of anonymity because he is not authorized to speak to the press on the matter. The girls were flown by helicopter to Maiduguri, the northeastern capital of Borno state and birthplace of Boko Haram, he said.

"We are extremely delighted and grateful," the Bring Back Our Girls movement said on Facebook. The group, which has campaigned within Nigeria and internationally for the release of the students, said it awaits the names of the released girls.

The abduction of 276 schoolgirls in April 2014 from a school in Chibok and the government's failure to quickly free them has caused international outrage and brought Boko Haram, Nigeria's home-grown Islamic extremist group, to the world's attention. Dozens of the girls escaped on their own, but most remain missing.

In May, one of the girls, Amina Ali Nkeki, escaped on her own. Shortly after her release Nkeki told her family that some of the kidnapped girls died of illness and that others, like her, have been married to fighters and are pregnant or already have babies, her mother told the press.

Since then Nkeki has been in the custody of the secret service where she is receiving medical care and trauma counseling, according to the government. Buhari's government has been criticized for keeping her isolated. The Bring Back Our Girls group and Human Rights Watch have asked whether Nkeki now is a detainee of the government.

The fact that so many of the schoolgirls have children is not surprising as Boko Haram leader Abubakar Shekau had said that he would marry the girls to his fighters, saying they should be married, not going to school. The name Boko Haram means "Western education is forbidden," or "sinful," in the Hausa language of northern Nigeria.

The extremists have attacked many schools and kidnapped many thousands of girls and boys during their 7-year insurgency that has killed more than 20,000 people, according to Amnesty International. In Thursday's statement, Shehu said more than 30,000 Nigerians have been killed "via terrorism." Some 2.6 million people have been driven from their homes by the insurgency and the United Nations has warned that tens of thousands face famine-like conditions.

Negotiations last year failed when Boko Haram demanded a ransom of $5.2 billion for the girls' freedom, according to a recently published authorized biography of Buhari by American historian John Paden. It was not clear if any money changed hands in this swap.