How was Nationalism a cause of imperialism? and what was gained economically through imperialism?

Each of the imperialist nations wanted to be bigger, badder, and richer than other nations. These nations obtained (stole) natural resources from the countries they ruled.