In modern political sciences Democracy is only a voting process which could of course lead to 'mob rule' or 'tyranny of the majority' as is often said.
The modern nation state however is not only based on 'democracy' and to understand nation states in this way is a gross oversimplification.
Democracy is part of a matrix of governmental organization processes, norms and structures which together create a system for the various branches of the ruling system to interact with each other horizontally , and to interact with the population vertically.
An important element to consider is the constitution which is a primary structure for regulating all of these elements; including (but not limited to) the polity's voting method.
Most lay people think of the democratic element of state organization as being the foundation for its legitimacy, but it's actually the constitution with all of it's bells and whistles which really serves this function. The voting element is an a necessary but not a sufficient element of a just nation state setup.