A Vienna court on Wednesday sentenced two men who helped a gunman carry out Austria's first deadly jihadist attack to life in prison as the months-long trial wrapped up.

Convicted Islamic State group sympathiser Kujtim Fejzulai went on a shooting rampage on November 2, 2020 in downtown Vienna, killing four and wounding 23 others before police shot him dead.

Two years later, six defendants -- four Austrians, a Chechen and a Kosovar -- stood trial for helping Fejzulai prepare for the shooting, even though they were not directly involved in the deadly attack.

After the jury deliberated for about a dozen hours, the verdicts were pronounced around midnight by the presiding judge.

One man was sentenced to life in prison for "contributing to murder" and another was given the same sentence for participating in terrorist crimes in connection with murder -- the trial's main charge.

Another two men facing the main charge were given prison terms of 19 and 20 years respectively, while the final two of the group were acquitted of it.

But they were found guilty of membership in a terrorist organisation and each was sentenced to a conditional prison term of two years.

To hear the verdicts, the men were led into the crowded courtroom, escorted by armed guards under tight security. Cameras were barred from the room.

They remained unfazed upon hearing their sentences.

Throughout the trial their lawyers argued they had barely known Fejzulai and had been unaware of what he intended to do -- portraying the evidence as circumstantial, inconclusive or lacking altogether.

The prosecution demanded the maximum penalties for all defendants, stating that evidence painted an unambiguous and very clear picture of the men's involvement, adding that "such insidious attacks on our values and democracy" would warrant them.

With the help of some of the accused, the gunman -- an Austrian citizen whose parents are from North Macedonia -- was allegedly able to obtain the weapons and the ammunition needed for the attack, while others provided logistical aid or encouraged Fejzulai.

In 2019, Fejzulai had been convicted and sentenced to 22 months in prison for trying to join the Islamic State group in Syria, before being arrested in Turkey and extradited to Austria.

In the wake of the EU member's deadliest shooting in decades, the Austrian government and its intelligence service were accused of failing to monitor the Islamist movement in the country.

As a result, Austria adopted a heavily criticised anti-terror law in 2021 that allows for increased surveillance.