The first wave of nationalism to sweep across Europe, prior to 1815, was a unifying reaction to Napoleon's invasions, conquests, and attempted conquests.
The second wave was the liberalist wave, a type of nationalism encouraged by the liberals as a reaction against the established and re-established legitimate powers institutionalized by the Congress of Vienna. The Liberals saw nationalism as the freedom of an ethnic group to express its identity, in defiance of any monarchy or other established authority. A nationalist state's legitimacy arises from the ethnic identity of the people, replacing the older legitimacy which arose from the hereditary claims of a dynasty. John Stuart Mill and his Liberals saw nationalism as the vehicle by which the masses could express themselves. For this same reason, Metternich opposed it.
The third wave of nationalism was more authoritarian; after 1848, this type of nationalism gave authority to governments to take steps in order to avoid another series of attempted revolutions.