DAKAR, Senegal — Dozens of schoolgirls from the northern Nigerian community of Dapchi were returned early Wednesday morning, dropped off by the same Boko Haram militants who kidnapped them more than a month ago.

The surprising turn of events was greeted with joy from parents whose daughters were safely returned, but the relief was tempered by suspicions that several girls had died, possibly of thirst, while in the hands of the militants. Some are apparently still being held.

Jauro Usman, a resident of Dapchi who is close to many of the parents of the kidnapped girls, said those who had been reunited were “very, very happy.”

“Boko Haram came themselves and dropped our daughters,” he said.

A photograph taken by another resident of Dapchi showed heavily armed, masked militants arriving on Wednesday in a truck crammed with girls, a black flag waving from the vehicle as onlookers raised their hands. After dropping off the captives, the militants offered a stern warning to parents, threatening to return if the girls went back to school.

Government officials said that at least 76 of the girls had been returned but that the total number of freed students was still being tallied. The girls were released at about 3 a.m. on Wednesday “through back-channel efforts and with the help of some friends of the country,” according to a statement from Lai Mohammed, Nigeria’s information minister. The return of the schoolgirls was “unconditional,” the statement said.

Residents said that at least one girl, Leah Sherubu, was still being held by militants. She is a Christian and had refused to follow the militants’ commands to be converted to Islam, according to residents who had spoken with the freed girls.

On the evening of Feb. 19, militants dressed in army fatigues stormed the secondary school for girls in Dapchi, rounding up 110 students and speeding off with their captives screaming and crying.

The government and security forces faced heavy criticism for failing to prevent the attack, which came almost four years after a similar kidnapping of nearly 300 girls in the northern community of Chibok. Dozens of the Chibok girls are now free, in large part because of ransoms paid by the government, but more than 100 are still being held.

On Wednesday, fighters rode into Dapchi apparently in the same vehicles they had used to kidnap the girls, dropping them along a federal highway near a bus station in town. The militants gathered residents around them and warned them not to send the girls back to school, according to Babale Abubakar, a local government worker who heard the vehicles zoom by in the morning and ran after them to see what was happening.

Boko Haram’s name can be loosely translated as “Western education is forbidden.” The group was founded years ago by adherents who wanted to create an Islamic state, hoping that it would put an end to years of corruption and neglect by government officials.

In past years, as it became increasingly violent, Boko Haram has been dogged by infighting and has split into factions, the most significant of which has received the backing of the Islamic State. American military officials and Nigerian security analysts have said that this faction was responsible for the kidnapping of the girls from Dapchi.

Mr. Abubakar said one released student had told him that five girls, who had been fasting before their abduction and who were already in a weakened state and extremely thirsty, had died while being held prisoner. Those girls asked for water but were given none and died not long after, he said. Other news outlets said that captives had been trampled in overcrowded trucks.

The girls told their parents that they had been heading toward Dapchi since Friday, and had been placed in a boat for part of the journey, leading residents to say they believed that the students might have been held across the border in Niger.

President Muhammadu Buhari of Nigeria said on Twitter that no ransom had been paid for the girls.

The statement from the information minister cited an “operational pause” that had been observed by security forces “to ensure free passage and also that lives were not lost.”

“For the release to work, the government had a clear understanding that violence and confrontation would not be the way out as it could endanger the lives of the girls,” the minister said in his statement.

The government of Nigeria paid millions of dollars in ransoms and released high-level Boko Haram commanders in exchange for the release of students from the school in Chibok. The ransom payments have led critics to express worry that they could inspire more kidnappings.

On Wednesday, advocates for the release of the Dapchi girls and of the rest of the kidnapped students from Chibok denounced the apparent deaths of some of the hostages, but said they were happy to see the return of the other girls. Still, they said, they wanted an explanation.

“The circumstances of this return shall also be interrogated,” one of the advocacy groups, Bring Back Our Girls, said in a statement.