Hungary’s parliament has beefed up the country’s asylum legislation, paving the way for a border fence to prevent the flow of migrants into the EU member state.

The four-metre high fence stretching along the 175 kilometre border with Serbia has been criticised by Hungary’s neighbours, human rights groups and the European Union.

The updated legislation will also allow Hungary reject asylum claims from people travelling from Syria, Iraq or Afghanistan through other so-called safe countries without asking for asylum there.

Hungary’s right-wing prime minister Viktor Orban said his country needed to be protected from a tide of migrants crossing its border with Serbia.