A court in Mauritania has convicted three men of belonging to the Islamic State extremist group and sentenced them to between five and 10 years in prison.

The men were arrested last year during a demonstration and authorities said they had IS flags and photos of the group's leader in their possession.

The court convicted the three late Tuesday on charges of terrorism, terrorist activities and possessing terrorist propaganda.

Public Prosecutor Ahmed Ould Moustapha said Wednesday the group leader received 10 years in prison while the other two received five and seven year sentences.

Mauritania has been occasionally attacked by the regional al-Qaida branch over the last decade and has supplied some prominent recruits to extremist groups.