Sixty-three women and children snatched by Boko Haram militants last month have escaped after walking dozens of miles to safety.

The group of women, teenaged-girls and toddlers were abducted on 22 June when the Islamists swept across three remote villages in Borno state, Boko Haram's north-eastern base. Thirty-one boys abducted alongside them were forced to become fighters as Boko Haram stepped up its bloody four-year campaign to re-establish a caliphate in religiously mixed Nigeria, Africa's most populous nation.

The women escaped on Friday and walked for almost 24 hours before authorities were alerted on Sunday. At least 50 militants were killed over the weekend after attempting to storm military and police bases while troops were patrolled surrounding villages, the army said.

Nigeria's government initially denied the mass abduction – the latest in a series that only came under the spotlight when more than 300 schoolgirls were abducted from Chibok in April. Almost 220 of those seized at the school in Borno are among several hundred people still missing after being abducted by Islamist militants.

"The women were locked in a compound when the Boko Haram went to do another operation," said Alhaji Sule, a member of one of the semi-official vigilante groups that have formed in the state capital, Maiduguri, and elsewhere because of attacks by the Islamist militants.

Around dusk, the militants warned the women not to escape or they would be hunted down, Sule said. But when their captors failed to return after several hours, the women broke open the door and escaped.

"They walked about 50km [31 miles]. When a person is running for their lives they can do this journey in one day," he said.

A government official said about half of those who escaped were able to reach their homes. The others were found wandering in the bush "weak and dazed". Many were now receiving medical treatment, the official added.

The escapes suggest a renewed military offensive may have put Boko Haram under pressure. The captives were being held near Gwoza, a remote mountain range that sprawls into neighbouring Cameroon and which the group has made their base since many of their camps within Nigeria have been attacked by air force jets. But the militants have continued to launch weekly strikes on remote villages with little troop presence.

"Some of the villages around here are ghost towns. In Chukon Gudo they set alight all the houses – there are only three houses remaining there," said Kabiru Garba, who fled his birthplace to the relative safety of Maiduguri. Villagers with nowhere to go had taken to sleeping in the bush at night for fear of attacks.

The outrage following the abduction of the Chibok schoolgirls has dwindled, with parents and residents saying they feel abandoned by the government.

"As I'm talking to you now, we haven't had any more news from anybody. Our elders are dying of grief but we are still being attacked by the Boko Haram," Mungo Park, a Chibok resident, said.

Insiders said Boko Haram is demanding the release of its detained members in a hostage swap for the girls, but the government has ruled out the move. The group has increasingly turned to lucrative kidnapping to fund its activities.

In the runup to elections less than a year away, internal politics have bedevilled attempts to flush out Boko Haram. Strained relations between federal and state officials – who are from an opposition party – have also undermined a 14-month state of emergency intended to crush the militants in three north-eastern states.

At the same time, Cameroon has been criticised for not cracking down on the militants – who have deep ties with communities on both sides of the border.