Still, the first cases of a strong nationalist sentiment emerged in the 19th century. The white Brazilian-born colonial oligarchy developed sentiments against the colonial system, and manifested hostility to the Portuguese authorities. There were local conspiracies to secede from Portugal as early as in 1789, but the Independence of Brazil took place in the 1820s, after the transfer of the Portuguese Court to Brazil during the Napoleonic Wars. Brazilians had a desire for self-governance and resented that wealth of the nation was taken to Portugal.[2]

After independence, Brazilian nationalism maintained its anti-Portuguese sentiment, expanding to anti-British and anti-Spanish American sentiments (specially against the countries of the Río de la Plata Basin, Argentina, Paraguay and Uruguay), shaping an anti-foreign nationalism.[2] The anti-Portuguese sentiment was in fact a common sentiment across all of Brazil, and helped to keep the country unified during the late colonial periods and the first chaotic years after independence. The Brazilian monarchy was also an unifying factor, as the majority of the elite accepted the authority of the kings and feared the consequences of a potential revolution of their slaves.[3] The elite envisioned a country of white peoples, but the slaves, mulattoes, and mestizos composed almost the two-thirds of the Brazilian population.[4] For this end, they encouraged European immigration, to increase the number of white people.[5]

The anti-Portuguese sentiment also led to an increased use of the French language, in detriment of the Portuguese language. France was seen at the time as a model of civilization and progress.[6] The literary nationalism began in the 1840s with the works of José de Alencar, who used French literary models to describe the regions and social milieus of Brazil.[7] Nationalist literary works became more complex in the second half of the 19th century.[8]