A former North Macedonia interior minister was sentenced to 18 years in prison on Friday for his part in orchestrating a mob attack on parliament in 2017, one of 16 people given jail terms over the violence.

Scores were injured in the bloody rioting that erupted on April 27, 2017 when around 100 nationalist demonstrators, including masked men, stormed the Skopje assembly at the culmination of a post-election political crisis.

Several lawmakers were beaten, including Social Democrat leader Zoran Zaev, who went on to become prime minister and pass the historic name deal with Greece that added "North" to former Macedonia's name, ending a long-running dispute.

A court in Skopje on Friday sentenced the 16 defendants, including some police officers, giving them prison terms ranging from seven to 18 years for "terrorist endangerment of the constitutional order and security".

The longest sentence was given to former Interior Minister and then-public security bureau chief Mitko Chavkov.

"The events were broadcast live, and citizens watched those terrible images with bleeding heads of lawmakers and journalists who were under attack, which undoubtedly caused insecurity and fear," judge Dobrila Kacarska said.

Fifteen others who were initially accused were earlier pardoned by an amnesty law passed by Zaev's government. One defendant was also acquitted on Friday.

The pardoned include five MPs from the opposition VRMO-DPMNE party who were key to passing the contentious name deal, which came into force last month.

The attack on the parliament followed months of protests by nationalists opposed to a coalition deal between Zaev's Social Democrats and minority ethnic Albanian parties.

The alliance eventually ousted the party of former PM Nikola Gruevski, who had held power for nearly a decade.

In November 2018 Gruevski fled to Hungary to escape a two-year prison sentence.

Last month North Macedonia authorities said Gruevksi and several other former senior officials are also being probed for allegedly plotting the parliament attack.