Gottesfreistaat (German for "God's free state" or "divine republic" - another kind of theocracy) is the name for a state form that existed for some time in the HRE.
There had been predecessors in spirit, like in Utrecht, the "beggar's republic" of Parma, and the theocracy of Bohemia, all being states without kings (or at least, hereditary kings) and aiming at more justice and equality and a reformation of the church.
The HRE had suffered under religiously motivated unrests since 1466, when returning pilgrims brought news about the Sacco di Roma. Many sects believed that the end of the world was near (the date of 1500 was most often mentioned). At first the war gave them hope that Rome could be eventually reconquered, but when Castille-Portugal gave up Rome in 1472, they became desperate. Unrest spread. At the same time, the growing riches (and corruption) of the church (which ruled many territories in Germany) and the growing power of the princes made some people wonder about secularization of said territories.
When king Heinrich VIII secularized and annexed the bistums of Augsburg and Trient for his lands in 1475, the HRE fell into a kind of Civil War. All the princes tried to annex the clerical lands, which lead to lots of confusion and little wars for said lands, which are subsumed as the Twenty-Year War.
In the same year, in the bisthums of Würzburg and Münster, millenialist sects took the power, declared the Gottesfreistaat. The latter ones even managed to extend their lands during the chaos of the war, deposing some small princes of NW Germany.
And to make the situation even worse, there were peasant uprisings (mostly in western Germany) who felt suppressed by the nobles. Those who couldn't flee to the territories of the Gottesfreistaaten where they were let in if they only swore to obey God's laws, were brutally suppressed.
During the reforms of the HRE 1500-08, the Gottesfreistaaten of Münster and Würzburg were put into Reichsacht (means: everyone may kill their people and take their lands). The end came in 1545 for Würzburg, when Burgrave Johann II von Hohenzollern of Ansbach and Bayreuth defeated and annexed it, thus forming the duchy of Franconia. And Münster was first weakened in 1582 by Nassau (with French support) and completely conquered by the same during 1676-79.