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," 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.