While I was reading Iris Chang's book (The Chinese in America), I gained the insight that it is the other way around: Racism is the conscequence of Colonialism.
Racism is necessary in order to justify colonialism. Put in a nutshell: I am taking over your land and to rule you because I am better.