While nationalism helped some countries come together, it also ripped some states apart.
Empires and kingdoms often consist of multiple ethnic groups. Some of those groups started to recall eras in history when they too had ruled themselves or even had their own empires. They wanted to have their own nations again. Witnessing other nations shaking off external rulers inspired them to act on those nationalistic feelings and form their own nation-states.
For example, people of many different backgrounds lived on the Balkan Peninsula in eastern and southeastern Europe. In the early 1800s, most of that area was ruled by the Ottoman Empire. Nationalistic spirit helped push several groups to gain their independence. One early bid for freedom came from the Greeks, who started fighting the Ottomans in 1821.