The main way in which the idea of nationalism fuels a country's quest for independence is that it creates an "us vs. them" mentality, in which the people of a colony or country unite against a common enemy--which is usually an occupying power or a foreign nation.