A Czech court has jailed a 71-year-old man for causing two passenger trains to derail in 2017 and attempting to blame Muslim immigrants, local media reported on Monday.

The Central Bohemian court sentenced Jaromir Balda to four years in jail and ordered him to undergo psychiatric treatment, according to video on news website www.aktualne.cz.

Balda felled trees onto railway lines north of Prague causing two trains to derail. No-one was hurt. He left behind leaflets in Arabic reading Allahu akbar, which means “God is greatest” in Arabic.

Balda said he had aimed to stoke public resistance to accepting migrants, media reported.

He was the first man to be convicted under Czech terrorism laws, according to state attorney Martin Bily.

There has been no significant growth in the number of asylum seekers entering the Czech Republic despite a sharp rise in immigration to Europe in 2015 that raised public debate over accepting migrants from the Middle East and north Africa.

The Czech Republic has rejected attempts by fellow EU countries to force member states to accept a quota system for the relocation of migrants and refugees.

Judge Jiri Wazik said Balda had been manipulated by public figures who preyed on people’s gullibility and fear.

“The defendant is in a way a victim of this manipulation, however that does not mean he is not criminally and humanly responsible for his actions. Perhaps he should have realized that hate breeds more hate,” the judge said in the video footage.

Czech media said Balda had made donations to the far-right, anti-Islam SPD party. The party condemned Balda’s actions on its website.

Balda and the state attorney can appeal the verdict.