From the beginning of human history people have had a sense of belonging to some tribe or group, distinct from other tribes or groups.
Loyalty to their tribe was a key element of the lives of primitive European peoples.
In more advanced societies, such as ancient Greece, people instead had a sense of belonging to a particular city-state, as Athenians or Spartans, and so forth.
There was also often a wider sense of belonging to a larger family of tribes or peoples, e.g., as Franks or Greeks.
Nationalism in its modern form became a major force in Europe in the 19th and 20th centuries, nations were formed or unified (e.g., Germany) on the basis of nationality, and the old multi-ethnic empires fragmented into nationally-organised states (Austrian-Hungarian empire and Ottoman Empire).
The principle of national self-determination of peoples was widely accepted after the 1st World War, and is incorporated into the Charter of the United Nations.
In Africa and Asia, nationalist aspirations were a key factor in the independence movements of many colonies.
Nationalism may be combined with many different forms of government, including unitary democratic (e.g., Israel) and federal (e.g., Russia) regimes. It is absurd for socialists and Marxists to accuse nationalists of being fascists, and also ironic, since Marx's doctrine of the 'dictatorship of the proletariat' led in practice to some of the most totalitarian regimes in history.
Nationalism does not necessarily lead to wars between nations; it is now far more common for nations to co-operate with each other than to go to war. In Europe there is a general understanding that most European peoples have much in common, with closely related histories, cultures and languages, and it would be very difficult for a few aggressive politicians to lead different nations to fight each other again.
Forces working against nationalism include trans-national governments such as the European Union, and multi-national companies, who wish to impose their political or economic power on different nations, and who try to enforce uniformity (of laws, regulations and consumer choices) in conflict with national individuality.
'Globalisation' of the world economy means that companies try to shift as many jobs as possible to regions with the lowest salaries, such strategies are aimed at benefiting the company, not any of the countries or peoples involved.
Economic internationalism has led to floods of imported products, destroying local manufacturing.
Militant Islam is also incompatible with nationalism: a Muslim’s first loyalty is expected to be to their faith, not their nation. By means of 'Jihad', Islam had from its beginning the objective of taking political control of societies in order to impose Islamic doctrine upon them (Muhammad himself set the first example of this).
Across countries, Islam aims at a uniformity of belief and conformity to the ancient (and anachronistic) codes of Sharia law. This idea of a trans-national Muslim religious empire was a reality for several centuries: a single religion-based authority -- the Caliphate -- ruled from North Africa to the Middle East and Iran, and suppressed local religions and languages, imposing Islam and Arabic.
This battle to subordinate nations to Islamic doctrines goes on today in many countries, with tactics ranging from terrorism and ethnic cleansing of non-Muslims (e.g., in Nigeria) to the more subtle creeping cultural subversion which we face (the pressure for more and larger Mosques, for Islamic schools, for Halal slaughter of animals, etc).
But the influence of nationalism is still very strong, and a trend towards greater localism and regional autonomy has occurred in many countries, including the UK. Despite all the efforts of internationalists to erase national identities, many people still feel a strong sense of belonging to a particular nation and even to particular regions, e.g., to Cornwall or Yorkshire, and local accents and dialects still persist.
A natural form of government for nationalists may therefore be a federation of local regions, with decisions concerning a local area being made locally where possible, and the national government restricted to coordination of regions and national-level activities such as border control and defence.