MAIDUGURI, Nigeria -- Twenty-one of the Chibok schoolgirls kidnapped by Boko Haram Islamic extremists more than two years ago have been freed in negotiations, officials 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 Nigeria’s Department of State Services, Nigeria’s secret intelligence agency, according to presidential spokesman Garba Shehu.

He said their release was negotiated between the government and Boko Haram in talks brokered by the International Committee of the Red Cross and the Swiss government. He said negotiations will continue for the release of the other students.

Get Breaking News Delivered to Your Inbox

Boko Haram long has offered to free the girls in exchange for detained leaders of the group. It was unclear if an exchange has taken place, but several news organizations in Nigeria suggested a handful of senior Boko Haram militants had been released.

The ICRC in the past had tried to negotiate a swap, which failed. Information Minister Lai Mohammed said last month that negotiations last year ended when Boko Haram demanded a ransom of $5.2 billion for the girls’ freedom.

The abduction of 276 schoolgirls in April 2014 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 President Muhammadu Buhari’s government.

The 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.