Twenty-one of the girls who were kidnapped from their school in northeastern Nigeria by Boko Haram militants have been freed, the president’s spokesman said Thursday.

The girls were among the 276 students the Islamist extremists kidnapped in the town of Chibok on April 14, 2014, sparking the viral "Bring Back Our Girls" social media campaign.

Some of the girls later escaped and in May, activists said a teenager and her young child had been saved from the group, in what was believed to be the first rescue. Some 197 girls are believed to remain missing.

Garba Shehu, spokesman for President Muhammadu Buhari, said on Twitter that the negotiations for the girls’ release were brokered by the International Red Cross and the Swiss government, and would continue.

The freed girls were with government authorities, he said.

The Associated Press reported that they were released in exchange for four detained Boko Haram leaders.

"I can only weep, right now. You know that kind of cry that is a mix of multiple emotions. Lord. Some of OUR Girls ARE BACK!!! B. A. C. K.!!," tweeted Oby Ezekwesili, of the Bring Back Our Girls campaign.

Buhari, who was heading to Germany on an official visit Thursday, welcomed the girls’ release. Shehu said the president "cautioned Nigerians to be mindful of the fact that more than 30,000 fellow citizens were killed via terrorism."

Buhari said cooperation on security and the humanitarian situation in northeastern Nigeria would be a ”significant part” of talks with German Chancellor Angela Merkel during his visit.