The European Union is preparing to grant Ukrainians who flee the war the right to stay and work in the 27-nation bloc for up to three years, senior European officials said on Monday.

The officials also added that EU border states would get help to cope with the arrivals.

At least 400,000 Ukrainian refugees have entered the EU so far, EU Home Affairs Commissioner Ylva Johansson said. EU members Poland, Romania, Slovakia and Hungary have land borders with Ukraine.

“We have to prepare for millions (to arrive in the EU),” Johansson told a news conference after a visit to a border crossing between Romania and Ukraine.

Johansson said she was hoping EU interior ministers would agree as early as Thursday on a protection scheme for those fleeing Ukraine.

Ministers on Sunday asked Johansson to prepare proposals to trigger the EU temporary protection directive, drawn up after the 1990s war in the Balkans, but never used so far.

Designed to deal with mass arrivals of displaced persons in the EU, it provides for the same level of protection, for one to three years, in all EU states, including a residence permit and access to employment and social welfare.

Speaking at a joint news conference with Johansson, Romanian Interior Minister Lucian Bode said that, with people waiting 20 to 30 hours on the Ukrainian side to get into Romania, it was crucial to agree on how to process their paperwork so that they would not have to wait hours on the EU side as well.

With men of conscription age prevented from leaving Ukraine, mostly women and children are arriving at the border in eastern Poland, Slovakia and Hungary and in northern and northeastern Romania.