how did imperialism and nationalism contribute to european nations prior to world war one?