How did nationaligm and the idea of the nation-state emerge?

How did nationaligm and the idea of the nation-state emerge ?

Nationalism and the idea of the nation state emerged within the culturally and regionally diverse groups of Europe. Due to industrialisation and transformation of society, there emerged a middle-class consisting of businessmen, working professionals, industrialists, labourers and working class people.
Out of these, the educated middle-class people thought of uniting the culturally compatible sections of people in Europe by abolishing the privileges enjoyed by the aristocracy.
This led to nationalism and emergence of idea of the nation-state.