DAKAR, Senegal — Dozens of the nearly 300 schoolgirls kidnapped by Boko Haram militants just over three years ago in the Nigerian village of Chibok have been released as part of an exchange for detained suspects from the militant group, a statement from Nigeria’s president said early Sunday.

The release of the girls is by far the biggest breakthrough in a tragedy that has come to define the nearly eight-year war against Boko Haram, the Islamist militant group that has burned, killed and kidnapped its way across parts of West Africa, killing thousands and causing millions to flee for their lives.

The government, after lengthy negotiations, handed over “some Boko Haram suspects held by authorities” in exchange for 82 of the girls, according to a statement from a spokesman for President Muhammadu Buhari. The statement credited the government of Switzerland, the International Committee of the Red Cross, local and international nongovernmental organizations, the military and security agencies with facilitating the exchange.

The girls were expected to arrive in Abuja, the capital, on Sunday to meet with Mr. Buhari.

“The president has repeatedly expressed his total commitment towards ensuring the safe return of the #ChibokGirls, and all other Boko Haram captives,” the statement said, referring to one of the social media campaigns on behalf of the girls.