Thousands of migrants have been crowded into a warehouse near the border between Poland and Belarus, after Belarusian authorities coaxed them into abandoning the freezing camps they occupied for weeks in the hopes of crossing into European Union territory.

The move by Belarus to clear the crude camp at its border with Poland—where thousands of migrants have braved bitter cold and, according to some, suffered ill treatment by Belarusian soldiers—could help de-escalate tensions between Minsk and the EU.

But it leaves the migrants’ fate hanging in the balance, as the EU leaders seek a solution to the standoff with Belarusian President Alexander Lukashenko.

EU leaders say Mr. Lukashenko’s government has encouraged the migrants, who are largely Middle Eastern, to travel to Belarus and attempt to cross the border into Poland as retribution for European sanctions against his regime. Mr. Lukashenko has denied orchestrating the crisis.

Such initiatives have deflated the hopes of many migrants of getting to the West, including about 430 people who on Thursday returned to Iraq on a repatriation flight from Belarus.

Among them were Ali Kadhum Hussien, 28 years old, who spent 10 days on the border between Belarus and Poland in the hopes of crossing and securing asylum in the EU.

He said Belarusian soldiers were initially helpful, guiding the migrants toward the border. But they beat them when they failed to cross over and were sent back by Polish authorities.

“The situation at borders is very bad,” Mr. Hussien said. “We were beaten badly by the soldiers. They didn’t even treat us like people.”

Dalya, 24, mother to an 18-month-old daughter, said she spent $20,000 to travel together with her mother and brother-in-law to Belarus, but decided to abandon her quest.

“We were afraid that my baby girl would die on the border, but the Belarusians didn’t let us return to Minsk,” she said as she landed in Iraq and headed home to the Kurdistan city of Sinjar. “They said if you go to Minsk, and return to the border again, they would open their dogs on us.”

But many migrants said they were still clinging to hope. Some continued to attempt to cross the border, with 255 attempts Thursday night, Poland’s Border Guard said.