BUDAPEST/SZEGED (Reuters) - A Hungarian court sentenced a Syrian-Cypriot man to seven years in prison for illegally crossing the border and for being an accomplice in “an act of terror” during clashes with police in September 2015, state news agency MTI reported on Wednesday.

Slideshow ( 4 images )

The preliminary ruling after a retrial of the case, which is milder than the original 10-year sentence issued in 2016, comes as Prime Minister Viktor Orban campaigns on an anti-immigrant platform ahead of an April 8 election he is expected to win.

Ahmed Hamed was part of a group that crossed illegally into Hungary on Sept. 16, 2015 and also spoke to the crowd using a loudspeaker before hundreds of migrants forced open the border gate and police fired water cannon and teargas.

A Reuters photographer in the courtroom in the southern Hungarian town of Szeged said the handcuffed man, who was also chained around his ankles and guarded by masked police, received the sentence calmly.

“We did not go to the border to cause problems,” Hamed was quoted as saying by local news website Index. “Neither my culture, nor my religion would encourage that.”

Hamed’s lawyer was not immediately available for comment. The court will issue a statement later on Wednesday. It was not clear when the court would issue its final verdict in the case.

As the holder of a Cypriot passport and therefore a citizen of the European Union, Hamed would be allowed to enter Hungary without a visa, but he was helping relatives and other Syrian citizens, MTI cited his lawyer as saying during the trial.

Nearly half of the more than one million migrants who surged into the European Union in 2015 passed through Hungary, often causing chaos at borders and along major highways.

Orban’s rightwing nationalist Fidesz party has strongly opposed EU quotas to share out the mostly Muslim migrants across the bloc and says they pose a threat to Western values and culture. Orban called Hamed a “terrorist” last June.

Orban’s tough stance on migration has helped shore up support for Fidesz among voters but it has drawn accusations of racism from the United Nations human rights chief.

The party, in power since 2010, suffered an unexpected setback at a recent municipal by-election, but remains well ahead of its rivals in opinion polls.