It can be argued that imperialism came before nationalism, as the concept of imperialism has been present in human history for centuries, while nationalism emerged as a modern political ideology in the 18th and 19th centuries. Imperialism is the practice of extending a country's power and influence through colonization, use of military force, or other means, often for economic gain. Nationalism, on the other hand, is the belief in the importance of a shared national identity and the desire for self-rule.
One historical event that illustrates the precedence of imperialism is the colonization of the Americas by European powers in the 15th and 16th centuries. This was driven by the desire for economic gain and control over resources, as well as a belief in European cultural superiority. Nationalism did not emerge as a dominant ideology until several centuries later, during the French Revolution and the subsequent rise of nation-states in Europe.
Furthermore, it can be argued that nationalism emerged as a response to imperialism, as colonized peoples began to assert their own identities and desire for self-rule in the face of foreign domination. This was seen in movements such as India's struggle for independence from British colonial rule in the 20th century.
In summary, while both imperialism and nationalism have had a significant impact on human history, imperialism can be seen as the earlier concept, with nationalism emerging as a response to imperialism in the modern era.