ABUJA, Nigeria (AP) - Nigerian President Muhammadu Buhari expressed joy at meeting Sunday with the 82 Chibok schoolgirls newly freed after being held captive for three years by Boko Haram Islamic extremists.

"We've always made it clear that we will do everything in our power to ensure the freedom & safe return of our daughters" and all captives of Boko Haram, Buhari said on his Twitter account.

But the president then announced he was leaving Sunday night for more medical checkups in London, renewing fears about the 74-year-old's health after he spent a month and a half on medical leave earlier this year and said he'd never been as sick in his life. The exact nature of his illness remained unclear. He has missed three straight weekly Cabinet meetings.

'Bring Back Our Girls' campaigners celebrate the release of the kidnapped Chibok school girls at the unity fountain in Abuja, Nigeria, Sunday, May. 7, 2017. Five Boko Haram commanders were released in exchange for the freedom of 82 Chibok schoolgirls kidnapped by the extremist group three years ago, a Nigerian government official said Sunday, as the girls were expected to meet with the country's president and their families. (AP Photo/ Sunday Alamba)

The news shook Africa's most populous country even as it rejoiced in the Chibok schoolgirls' return.

Photos tweeted by the president showed dozens of the girls at Buhari's official residence Sunday evening, a day after their release.

"The president was delighted to receive them and he promised that all that is needed to be done to reintegrate them into the society will be done," adviser Femi Adesina said. "He promised that the presidency will personally supervise their rehabilitation."

The young women have been handed over to government officials who will supervise their re-entry into society, Adesina said. The International Committee of the Red Cross, which helped negotiate the girls' release along with the Swiss government, said they would be reunited with their families soon.

Five Boko Haram commanders were released in exchange for the girls' freedom, a Nigerian government official said Sunday. The official spoke on condition of anonymity as he was not authorized to speak to reporters on the matter. Neither Nigeria's government nor Boko Haram, which has links to the Islamic State group, gave details about the exchange.

Parents of the schoolgirls were waiting for a government list of names of those who had been freed.

Some parents of the kidnapped girls gathered in the capital, Abuja, to celebrate the release, while others expressed anxiety over the fate of the 113 girls who remain missing after the mass abduction from a Chibok boarding school in 2014.

The Rev. Enoch Mark, whose two daughters have been among the missing, was still awaiting word if they were among those freed. He emphasized that he considered all 82 of the girls to be his daughters "because most of them worship in my church."

Some parents did not live long enough to see their daughters released, underscoring the tragedy of the three-year saga. And the recovery process is expected to be a long one for the girls, many of whom endured sexual assault during their captivity.

"They will face a long and difficult process to rebuild their lives after the indescribable horror and trauma they have suffered at the hands of Boko Haram," said Pernille Ironside, acting representative of UNICEF Nigeria.

Boko Haram seized a total of 276 girls in the 2014 abduction. Girls who escaped early on said some of their classmates had died from illness. Others did not want to come home because they'd been radicalized by their captors, they said.

Human rights advocates also fear some of the girls have been used by Boko Haram to carry out suicide bombings.

Last year, a first group of 21 Chibok girls was freed in October, and they have been in government care for medical attention, trauma counseling and rehabilitation. Human rights groups have criticized the decision to keep the girls in custody in Abuja, nearly 900 kilometers (560 miles) from Chibok.

It was not immediately clear whether the newly freed girls would join them.

They should be quickly released to their families and not be subjected to lengthy government detention, Amnesty International's Nigeria office said, adding that the girls don't deserve to be put through a "publicity stunt" and deserve privacy.

Though Boko Haram has abducted thousands of people during its eight-year insurgency that has spilled across Nigeria's borders, the Chibok mass kidnapping horrified the world and brought the extremist group international attention.

The failure of Nigeria's former government to act quickly to free the girls sparked a global Bring Back Our Girls movement; U.S. first lady Michelle Obama posted a photo with its logo on social media.

The Bring Back Our Girls campaign said Sunday it was happy that Nigeria's government had committed to rescuing the 113 remaining schoolgirls, and it urged the president to "earnestly pursue" the release of everyone held by Boko Haram.

Buhari late last year announced Boko Haram had been "crushed," but the group continues to carry out attacks in northern Nigeria and neighboring countries. Its insurgency has killed more than 20,000 people and driven 2.6 million from their homes, with millions facing starvation.

___

Associated Press writers Haruna Umar in Maiduguri, Nigeria and Sunday Alamba in Abuja, Nigeria contributed.

Martha Mark, who says two of her daughters are missing and that she is hoping they are among the girls released, attends the daily 'Bring Back Our Girls' rally at the unity fountain in Abuja, Nigeria, Sunday, May 7, 2017. Five Boko Haram commanders were released in exchange for the freedom of 82 Chibok schoolgirls kidnapped by the extremist group three years ago, a Nigerian government official said Sunday, as the girls were expected to meet with the country's president and their families. (AP Photo/Sunday Alamba)

Esther Yakubu, a woman who says one of her daughter is missing waits for news if she is among the girls released in Abuja, Nigeria, Sunday, May. 7, 2017. Five Boko Haram commanders were released in exchange for the freedom of 82 Chibok schoolgirls kidnapped by the extremist group three years ago, a Nigerian government official said Sunday, as the girls were expected to meet with the country's president and their families. (AP Photo/ Sunday Alamba)

Chibok school girls recently freed from Boko Haram captivity are seen in Abuja, Nigeria, Sunday, May 7, 2017. The 82 freed Chibok schoolgirls arrived in Nigeria's capital on Sunday to meet President Muhammadu Buhari as anxious families awaited an official list of names and looked forward to reuniting three years after the mass abduction. (AP Photo/ Olamikan Gbemiga)

Rev. Enoch Mark, who says two of his daughters are missing and he is hoping they are among the girls released, attends the daily 'Bring Back Our Girls' rally at the unity fountain in Abuja, Nigeria, Sunday, May 7, 2017. Five Boko Haram commanders were released in exchange for the freedom of 82 Chibok schoolgirls kidnapped by the extremist group three years ago, a Nigerian government official said Sunday, as the girls were expected to meet with the country's president and their families. (AP Photo/ Sunday Alamba)

Aisha Yusuf, a 'Bring Back Our Girls' campaigner, speaks on the release of the kidnapped Chibok School Girls at the unity fountain in Abuja, Nigeria, Sunday, May 7, 2017. Five Boko Haram commanders were released in exchange for the freedom of 82 Chibok schoolgirls kidnapped by the extremist group three years ago, a Nigerian government official said Sunday, as the girls were expected to meet with the country's president and their families. (AP Photo/ Sunday Alamba)

Chibok school girls recently freed from Boko Haram captivity are seen in Abuja, Nigeria, Sunday, May 7, 2017. The 82 freed Chibok schoolgirls arrived in Nigeria's capital on Sunday to meet President Muhammadu Buhari as anxious families awaited an official list of names and looked forward to reuniting three years after the mass abduction. (AP Photo/ Olamikan Gbemiga)

Chibok school girls recently freed from Boko Haram captivity are seen in Abuja, Nigeria, Sunday, May 7, 2017. The 82 freed Chibok schoolgirls arrived in Nigeria's capital on Sunday to meet President Muhammadu Buhari as anxious families awaited an official list of names and looked forward to reuniting three years after the mass abduction. (AP Photo/ Olamikan Gbemiga)

Chibok school girls recently freed from Boko Haram captivity are seen in Abuja, Nigeria, Sunday, May 7, 2017. The 82 freed Chibok schoolgirls arrived in Nigeria's capital on Sunday to meet President Muhammadu Buhari as anxious families awaited an official list of names and looked forward to reuniting three years after the mass abduction. (AP Photo/ Olamikan Gbemiga)

Chibok school girls recently freed from Boko Haram captivity are seen in Abuja, Nigeria, Sunday, May 7, 2017. The 82 freed Chibok schoolgirls arrived in Nigeria's capital on Sunday to meet President Muhammadu Buhari as anxious families awaited an official list of names and looked forward to reuniting three years after the mass abduction. (AP Photo/ Olamikan Gbemiga)

Chibok school girls recently freed from Boko Haram captivity are seen in Abuja, Nigeria, Sunday, May 7, 2017. The 82 freed Chibok schoolgirls arrived in Nigeria's capital on Sunday to meet President Muhammadu Buhari as anxious families awaited an official list of names and looked forward to reuniting three years after the mass abduction. (AP Photo/ Olamikan Gbemiga)

Rev. Enoch Mark, centre, who says two of his daughters are missing and he is hoping they are among the girls released, attends the daily 'Bring Back Our Girls' rally at the unity fountain in Abuja, Nigeria, Sunday, May 7, 2017. Five Boko Haram commanders were released in exchange for the freedom of 82 Chibok schoolgirls kidnapped by the extremist group three years ago, a Nigerian government official said Sunday, as the girls were expected to meet with the country's president and their families. (AP Photo/ Sunday Alamba)

'Bring Back Our Girls' campaigners celebrate the release of the kidnapped Chibok school girls at the unity fountain in Abuja, Nigeria, Sunday, May 7, 2017. Five Boko Haram commanders were released in exchange for the freedom of 82 Chibok schoolgirls kidnapped by the extremist group three years ago, a Nigerian government official said Sunday, as the girls were expected to meet with the country's president and their families. (AP Photo/ Sunday Alamba)