I wasn't talking so much in political terms, but now that you brought this up, can you name me any European country that has managed do deal well with immigration? Maybe I just never hear about the success stories but seems that old colonial powers have been in trouble with this for ages and now Swedes and Danes and others which I view as relative new comers are following and I'm just wondering do we even have an example case of how to do this right and get people integrated and not get a xenophobic rejection from the main population.
Not a single country is doing as well as it should because of people's natural tendency towards xenophobia and the problems outsiders have in being accepted and getting a foothold in society. For the most part, that's hard to legislate around. Of course there are things to consider, such as making sure immigrants have the same rights and are being actively helped in their integration process, but it mostly plays out in a way that's hard to affect. It's well known that immigrants usually statistically perform worse in a number of ways, such as education and poverty levels, and that's mostly because the society's deck is stacked against them.
But what needs to be done is really pretty obvious: you need to invest in these people. Give them free language lessons, give them the same rights and opportunities that other people have, and try to bring them into a situation where they can perform to the best of their abilities. And actually give them a chance, such as through affirmative action.
It's sometimes suggested by right-wing parties that you shouldn't invest in immigrants at all "because that's just more taxpayer money going into an unsolvable problem" and that's pretty much the worst position ever because it greatly increases the likelihood they'll remain stuck in their own communities. Which, by the way, ends up costing a great deal more once you realize it has made them unable to participate in society in the way that they could have had they received some minor attention upfront.