It emerged from two main sources: the Romantic exaltation of "feeling" and "identity" [see Herder above all on this] and the Liberal requirement that a legitimate state be based on a "people" rather than, for example, a dynasty, God, or imperial domination.
Nationalism from Romantic "exaltation of "feeling" and "identity" and Liberal requirement that a legitimate state be based on "the people."