Democracies were forming all across the world during the early modern age in multiple different cultures, and the Islamic world was no exception. Above, you can see the coat of arms of Algiers that was used for the Regency of Algiers. This government was technically formed back in 1516, but before a certain year, the regency was not fully autonomous and was under the jurisdiction of the Ottoman Empire.
By the year 1659, the Regency was independent and able to be known as the Sovereign Military Republic of Algiers. This form of government, while not unheard of in the Muslim world, was unique for the time since the rulers were elected through a form of democracy. The democratic society was praised by some Muslim and Sufi scholars of the time. Even the Western philosopher Jean-Jacques Rousseau of the Western Enlightenment praised the democratic republic.
The democracy was described in detail by William Shaler, an American consul to the Regency government:
The merits of this government have been proved by its continuance, with few variations in it forms of administration, for three centuries. It is in fact a military republic with a chief elective for life, and upon a small scale resembling that of the Roman Empire after the death of Commodus. This government ostensibly consists of a sovereign chief, who is termed the Dey of Algiers, and a Divan, or great Council, indefinite in point of number, which is composed of the ancient military who are or have been commanders of corps. The divan elects the Deys, and deliberates upon such affairs as he chooses to lay before them — William Shaler, Sketches of Algiers, 1826
The nation lasted from 1659 and the way until the year 1830 with the invasion of Algiers. In that final year, the population of the country was around five million people and while it was mostly Sunni Muslims, it also included Christians, Jews, Shia Muslims, and Ibadi Muslims. The capital of the nation was Algiers and the official languages were Turkish & Arabic.