For John Stuart Mill there is bad (=vulgar) patriotism and good (noble) patriotism.
We need scarcely say that we do not mean nationality in the vulgar sense of the term; a senseless antipathy to foreigners; an indifference to the general welfare of the human race, or an unjust preference of the supposed interests of our own country; a cherishing of bad peculiarities because they are national or a refusal to adopt what has been found good by other countries.
And the good:
The third essential condition of stability in political society, is a strong and active principle of cohesion among the members of the same community or state
We mean a principle of sympathy, not of hostility; of union, not of separation. We mean a feeling of common interest among those who live under the same government, and are contained within the same natural or historical boundaries. We mean, that one part of the community shall not consider themselves as foreigners with regard to another part; that they shall cherish the tie which holds them together; shall feel that they are one people, that their lot is cast together, that evil to any of their fellow-countrymen is evil to themselves, and that they cannot selfishly free themselves from their share of any common inconvenience by severing the connexion.
Put in other words, good patriotism is one of the larger circles of sympathy, bad patriotism is the limit of sympathy.
But, where does good patriotism come from? What makes people “feel that they are one people”? Could it be that in practice it arose from a sense of antipathy to foreigners? Was bad patriotism the father of good patriotism?
From Mill, A System of Logic 1875 edition.