A Hungarian court has convicted a Syrian refugee of "complicity in an act of terror" and given him a sentence of seven years' imprisonment and a 10-year expulsion from Hungary.

The refugee, referred to as Ahmed H in court proceedings, was also convicted on Wednesday of "illegal entry as part of a mass riot".

The charges stem from an incident on the Hungary-Serbia border in 2015, when a group of asylum-seekers tried to enter EU territory at the Roszke crossing, near the Hungarian city of Szeged.

"After more than two and a half years behind bars, this absurd decision comes as a devastating blow for Ahmed, his wife, and his two young daughters," Eda Seyhan, Amnesty International's campaigner on counterterrorism in Europe, said in an email to Al Jazeera.

At the time of the incident, Ahmed H, 41, was accompanying his elderly parents on their route from Syria to the EU at the peak of the 2015 refugee crisis. Hungary had tightened border controls to block incoming refugees.

Stone throwing

Ahmed H - a legal resident of Cyprus - was previously convicted of "terrorism" charges in 2016 for throwing stones at police officers at the border crossing. A retrial was ordered in June after an appeals court decided that not all evidence was considered. It began in January.

Evidence at the retrial consisted mostly of videos and testimony from security officers on the border at the time of the incident.

A video showed Ahmed H telling police with a megaphone that asylum seekers "came in peace" and would not hurt officers during a tense standoff between refugees and Hungarian authorities.

Eventually, Hungarian police responded with tear gas and a water cannon. Many of the asylum seekers then threw objects, including rocks, at the officers.

During the retrial, Ahmed H admitted to throwing two stones after video evidence was shown.

Seyhan said none "of the evidence against Ahmed constitutes an act of terror and his conviction was a blatant misuse of terrorism-related provisions".

Amnesty also criticised Hungary's counterterrorism laws, saying they are "vague" and allow authorities to "curb a number of rights" without judicial oversight.

'Ahmed H is a terrorist'

The Hungarian government says its counterterrorism provisions are similar to those of Western European nations.

The government's official Facebook page posted a photo album titled "Ahmed H is a terrorist" during the retrial in January.

{articleGUID}

When asked for comment, a Hungarian government spokesperson told Al Jazeera that prosecutors at the trial - as well as Parliamentary State Secretary of the Justice Ministry Pal Volner - took the position that Ahmed H's actions were an act of "terrorism", and the courts agreed.

The spokesperson quoted Volner as saying it's "not possible to break through the border barrier in Hungary unpunished and throw stones at police within the framework of a mass riot".

The government, headed by Prime Minister Viktor Orban, has taken a hardline stance against refugees, whom they refer to as migrants.

Orban said during a radio programme on March 2 that "if we make the wrong decision, Hungary will become an immigrant country".