Throughout the 19th century and in to the early 20th century campaigns for national independence and democracy often went hand in hand. Many believed that the two concepts were inextricably linked, and do to this day.
Nations are the best state for democracies to flourish in, because of the feelings of trust and unity that come from a shared culture and national identity. People are more likely to make the compromises that democracy requires and feel obligations towards other citizens if they feel they are part of the same community. This claim is backed up by two different sorts of arguments which differ based on whether nations are modern creations or older natural units. Those who view nation-states as a modern political form believe that the first manifestations of nationalism were in the American and French Revolutions. These revolutions imagined that the unity of a state was not based on its leader (i.e. the king) but on the common culture of 'the people' and as such, the right to rule lay not with kings, aristocrats, or priests but with 'the people'. The result was the creation of the first democracies to exist on a scale larger than a single city-state. Although not all of the population was enfranchised, the mere principle of popular consent to governance was revolutionary. Since then, democracy and nationalism have gone hand in hand, most notably in the idea of national self-determination. Since the 18th century nearly all successful democratic movements have also been nationalist ones.
The claim that democracy has built nations is flawed. From the start, groups like women, the poor and people of colour were prevented from voting. These exclusions were central to the nature of these new states, suggesting that these groups had to be excluded if democracy was to work properly. Today these exclusions still persist in many ways; most notably through voter disenfranchisement. Many nations that claim to draw legitimacy from the people in reality are not democracies. Modern dictatorships from Juan Peron in Argentina to the one-party states of China and Vietnam are often very nationalistic in their rhetoric and policies, but are not democracies. It is also not clear that democracies can only function in nations. There is a long history of democracies in smaller communities like villages and cities which were arguably more democratic than national democracies.
[P1] Nationalism is based on the belief that political legitimacy and right to rule comes from the people. [P2] Nationalism has created the first large scale democracies in history, and most successful democratic movements have also been nationalist.
Rejecting the premises
[Rejecting P1] National democracies have not always been based on believing that the right to rule comes from all people - only a select few. [Rejecting P1] Many nations were not, and are not, democratic even if they do appeal to the people for legitimacy. [Rejecting P2] Correlation does not imply causation. The fact that most functioning democracies are nations does not mean democracy can only happen within nations.