"You shouldn't enter a country through a hole in a fence," the judge tells Mustafa, a Syrian migrant charged with a new type of crime created in Hungary only last month -- illegally entering the country by crossing the newly-built barrier on the border with Serbia.

"You should knock on a door when you want to come into a house," adds the judge, Gy. Molnar Sandor, during the trial taking place in the southern Hungarian city of Szeged.

The government ordered the building of the razor wire barrier in August to stem the flow of migrants, with more than 320,000 crossing Hungary so far this year, most headed on via Austria to Germany.

But hundreds continued to climb over or crawl under the fence even after the new legislation came into force on September 15.

Since then, there have been more than 400 fast-track trials of migrants -- mostly Syrians and Iraqis -- charged with the crime.

Meanwhile, the fence has merely shifted the problem as people now mostly arrive in Hungary via its border with Croatia and are taken to Austria on trains provided by the authorities.

"No one told me I could go through Croatia," Mustafa said, his hand shaking as he holds a copy of his verdict, an expulsion order barring him from Hungary for two years, and ordering his removal to Serbia, deemed a "safe" country by Hungary.

His name will also be entered in an EU database, possibly preventing him from entering any country in the bloc's passport-free Schengen zone.

"They say they are brought to the fence by smugglers in Serbia, they really are victims," said Mohammed Kerro, a Kurdish-speaking interpreter who has been working at three or four trials every day for the last three weeks.