A court in Ethiopia has handed jail terms ranging from seven to 22 years against 18 Muslims who were convicted on terror charges, including allegedly attempting to establish a religious government.

The sentencing on Monday attracted outcry from Muslim activists who opposed the trial.

Four of the suspects were sentenced to 22 years in prison, while the rest were given shorter jail terms.

Dimtsachin Yisema, a group lobbying for the release of Muslim detainees, said the sentences were "unjust" and called the Federal High Court a "kangaroo court."

The convicts, who were tried under Ethiopia's controversial anti-terrorism law, include Muslim leaders and activists who were arrested in July 2012 following six months of public protests in Addis Ababa and other towns over alleged government interference in religious affairs.