Political figures like Donald Trump, Xi Jinping, Viktor Orban, and Naredna Modi call themselves nationalists. Those who oppose their politics, seeing them as dictatorial and anti-democratic, now fear that nationalism promotes illiberal anti-democratic politics.
Nationalism in democracies is inherently majoritarian - whatever the majority decides, goes. This is illiberal as the rights of the minority are not recognised in any way. Those that do protest are cast as speaking against "the will of the people" and portrayed as traitors to the nation. Signs of difference are persecuted. As there is rarely a single united people all sharing the same characteristics and views, demagogues who pretend to speak for "the people" take control and persecute any who disagree with them. This ends up destroying democracy itself.
The nation is the foundation of democracy. Nations are based on the idea of self-determination and the idea that political legitimacy comes from the people. This means that citizens can always attack their government for failing to live up to democratic claims. Rejecting nationalism doesn't mean rejecting the nation. Many critics of nationalism in fact feel that the so-called nationalists are the ones betraying the nation by oppressing large parts of the population and enriching themselves at the costs of the nation. Most believe that it is possible to love one's nation while rejecting dangerous nationalism.
[P1] Nationalism is illiberal. [P2] Illiberalism means the end of democracy.
Rejecting the premises
[Rejecting P1] The nation is the foundation of democracy.