ABUJA, Nigeria -- Five Boko Haram commanders have been released in exchange for the freedom of 82 Chibok schoolgirls, says a Nigerian government official.

The official spoke on condition of anonymity as he was not authorized to speak to reporters on the matter.

The confirmation of the prisoner swap Sunday came a day after the young women were liberated after more than three years in captivity by the Islamic militants.

There was no immediate comment about the exchange from the Nigerian presidency or Boko Haram, the extremists linked to the Islamic State of Iraq and Syria (ISIS). President Muhammadu Buhari said Saturday that some Boko Haram prisoners had been released for the freedom of the schoolgirls, but he did not give any details.

Get Breaking News Delivered to Your Inbox

The freed young women were flown Sunday by military helicopters from northeastern Nigeria to Abuja, the capital, where they met with Nigerian President Muhammadu Buhari.

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

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.

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

Authorities say 113 schoolgirls remain missing of the 276 girls abducted from their boarding school in 2014. Girls who escaped 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 kidnapped from the Chibok boarding school were used by Boko Haram to carry out suicide bombings.

Last year, 21 other Chibok girls were liberated in October and they have been undergoing counseling for months. It was not immediately clear whether the newest girls freed Saturday would join them.

Those girls are still in government care in Abuja for medical attention, trauma counseling and rehabilitation, according to the government. Human rights groups have criticized the decision to keep the girls in custody in Abuja, nearly 560 miles from Chibok.

Saturday's release marks the largest negotiated release so far of the 276 girls whose abduction in 2014 drew international attention to the threat of Nigeria's extremists. Boko Haram has pledged allegiance to the Islamic State, and has increasingly carried out attacks in neighboring countries.

The mass kidnapping horrified the world and brought Boko Haram 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.

Chibok school girls recently freed from Boko Haram captivity are seen in Abuja, Nigeria, Sunday, May 7, 2017. Olamikan Gbemiga / AP

The Bring Back Our Girls campaign said Sunday it was happy that Nigeria's government had committed to rescuing the 113 remaining schoolgirls.

"We urge the president and his government to earnestly pursue the release of all our Chibok girls and other abducted citizens of Nigeria," the group said in a statement.

The schoolgirls kidnapped from Chibok in 2014 are among thousands of people abducted by Boko Haram over the years.

A Nigerian military official with direct knowledge of the rescue operation said the freed girls were found near the town of Banki in Borno state near Cameroon.

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.