The Pirate Utopia of Salé on the Moroccan coast was a truly independent state for decades in the 16th century. While the rest of North Africa was being carved up among the Ottomans and various Sufi princes, democracy of a kind was flourishing.
Salé was ruled by the Taiffe Reisi or Council of Captains and the Divan, which was populated by former commander-in-chiefs. Becoming a voting member of the legislature was as simple as staying alive long enough to rise through the ranks of corsairs. Every two months a new commander-in-chief, "Agha of Two Moons," took over as head of the corsair fleet. This gave an unprecedented level of opportunity to men who took up the vocation of corsair. A man, regardless of birth, could rise to the highest levels of government.
This form of government was the first democratic government after Greece and heavily influenced European Democracies that would follow it.
Modern Salé and Rabat