Hundreds of migrants stranded at an abandoned camp in Bosnia and Herzegovina were spending New Year’s Eve in freezing temperatures, according to humanitarian groups, as authorities in the country struggled to balance their safety with growing hostility from local populations.

Around 700 people on Wednesday were sleeping in abandoned shipping containers and in the open in and around the former camp of Lipa, in northwestern Bosnia. They were living in squalid conditions, lacking electricity, water, winter clothes and tents, the humanitarian organizations said.

The Lipa camp was abandoned last week after it was deemed unsafe by aid workers. As the migrants left, a fire destroyed most of the tents left behind.

The migrants, mostly from Afghanistan, Pakistan and Bangladesh, were supposed to be relocated to an old military site in the nearby city of Bihac this week, but Bihac’s mayor has refused to accommodate them. The buses that came to transport the migrants to Bihac allowed some to shelter in the vehicles on Tuesday night, but left Lipa empty the next day.

The migrants’ uncertain fate was the latest example of Bosnia’s struggle to provide basic assistance to those hoping to reach the European Union. Migrants have faced increased animosity from residents on the Bosnian side of the border, and abuses by Croatian police on the other.

On Thursday, the Bosnian government agreed to relocate the migrants from Lipa to Bihac, 15 miles to the north “very quickly,” it said, but didn’t provide an exact date.

“We emphasize that this is an urgent and temporary care for migrants during the winter months, until the Lipa reception center is built and equipped for a longer stay,” the interior ministry said in a statement, adding that the Lipa camp would be rebuilt, with water and electrical service, and be ready to permanently house migrants by April.

The ministry called for local authorities to facilitate the transfer and help accommodate migrants in the camp in Bihac in the meantime. “Obstructing and rejecting the proposed solutions for the accommodation of migrants who are now in the open, can only worsen the humanitarian situation, cause additional suffering and even human casualties,” it added.

But Peter Van der Auweraert, the chief of mission in Bosnia for the International Organization for Migration, said he was not optimistic that the decision would be enforced any time soon due to local opposition.

“Dozens of people are protesting with the mayors of two towns who say they don’t want to accommodate migrants, and as a result, the state, whose mandate is to relocate those migrants, bows to pressure and decides not to move,” Mr. Van der Auweraert said.

“But those migrants and refugees are in dire need of lifesaving humanitarian assistance,” he added.

As countries like Turkey, Greece and Hungary have made it more difficult for migrants and refugees to reach the wealthier nations of the European Union, Bosnia has in recent years become a central point of passage for those making their way into the continent. The Balkan nation is not part of the European Union, but it shares more than two-thirds of its borders with Croatia, a member state.

While 750 migrants were recorded passing through Bosnia in 2017, there were over 29,000 last year. That number decreased to 17,000 this year, according to Mr. Van der Auweraert, who said that despite the smaller figure, the failure to accommodate them had made the crisis worse.

Since Bosnia became a transit route in early 2018, thousands of migrants, mostly men, have stayed in Bihac and other nearby towns surrounded by icy hills and mountains, the European Union just a few miles away.

Human rights organizations and locals in those remote areas have reported numerous instances of abuse by the Croatian police. Dozens of migrants, residents, doctors and aid workers interviewed this year by The New York Times said migrants were being deported without due process.

Increasingly, anti-immigrant attitudes in places like Bihac have festered, too. “I don’t want them here, and they don’t want to be here, either,” Suhret Fazlic, Bihac’s mayor, told The New York Times in 2018.

Residents of his small city, near the border with Croatia, gathered on Wednesday in front of the barracks of the old military site, promising to block the entry of any migrants.

“For three years now, we have been carrying the burden of the migrant crisis and providing accommodation for migrants,” Mr. Fazlic told local news outlets, adding that he would refuse to carry out the order to relocate them.

The camp in Lipa was established in April as a temporary response to the Covid-19 pandemic. But Mr. Van der Auweraert, at the International Organization for Migration, said his organization, as well as the Red Cross, Médecins du Monde and the Danish Refugee Council, had made it clear to Bosnian authorities that the camp, mostly made of tents, was not a viable long-term solution.

The camp was never “winterized,” the organizations said in a statement this week, a process that generally includes adding thermal floor mats and insulation to shelters, and distributing blankets, heating stoves and fuel.

Up to 1,600 people lived in the camp, without electricity or water, on slopes exposed to strong winds, and organizations running the facility dismantled it last week after it was deemed unsafe. A prayer tent collapsed earlier this month, and Mr. Van der Auweraert said residents were in danger by staying in the camp.

“It was more secure for them to go somewhere in abandoned buildings in the area, than staying in big tents where the risks of collapse and fire had increased,” he added.

Nearly a thousand of the migrants headed for the vicinity of Bihac, where they have stayed in makeshift camps and abandoned buildings, but hundreds have remained around Lipa. Their hope is to be relocated to an old military site in Bihac, a former housing facility for migrants that local authorities closed this fall.

Earlier plans to move the migrants to another town were also dropped after the mayor and local politicians there refused to cooperate.

On Thursday, footage shared on social media by local news outlets showed men trying to warm themselves around a fire, under the remains of a tent in Lipa. Some could be seen walking on the frozen ground with sandals and without socks.

Mr. Van der Auweraert said that aid groups on Thursday would provide the migrants stranded in Lipa with winter sleeping bags, warm clothes and food, while the Bosnian civil protection agency would distribute tents.

But leaving the migrants in tents in icy conditions wasn’t sustainable, he said.

“If you don’t open the camp in Bihac, you keep people in abandoned buildings, uncontrolled,” Mr. Van der Auweraert said. “I don’t see how that is better for the security of locals there, rather than having a centralized camp that provides the most basic services to those who need them.”