Good points here.
When people immigrate into a country, they do so on the basis of knowingly abandoning the country from which they're coming in favour of that to which they're immigrating, for whatever reasons (including situations in which the country from which they're is coming has abandoned them); it is therefore reasonable to expect that they abide by the law of their new country as they'd be expected to abide by those from which they've come (even though there may be differences between those laws) and that they make every effort to acquire at least a basic grasp of those laws and those differences.
This, however, can become very complex indeed when people have to go through other countries in order to arrive at their intended destination, especially when their journeys get gravely delayed in those countries.
Not only that, though, each nation's own laws change all the time and, whilst rape and murder are unlikely ever to be considered other than as serious crimes in many countries, the punishments that they attract can vary not only from case to case but also from time to time.
The Nazi flag issue is an important one; yes, there are differences as to whether or not waving one is regarded as a criminal act in certain countries, but this might beg the question as to whether it might be a reasonable expectation that it becomes a criminal act where it is not currently regarded as such. The crucial determining factor should, I think, be whether such flag waving is intended to cause grave offence; waving swastikas around is generally done for that very specific inflammatory purpose, whereas waving he US flag would not be so - unless done in Iran or other heavily Islamic or otherwise strongly anti-American countries. So it's the intent that counts - but that's not always as easy to prove as it might be should a large group of Western builders manage to get into Mecca and start building a synagogue, for example. One might say the same for waving the IS flag; that is likely to cause offence or worse in many countries, even those in which IS still operates.
Even rape is another grey area. Widely deplored in the West, it can be overlooked in certain excessively paternalistic societies, but then what's acceptable in certain Western nations has also changed somewhat over the years; rape within marriage is now increasingly being regarded similarly to other rape, for example.
Likewise, US has different degrees of murder and other Western nations have laws to distinguish between murder and manslaughter; not every country regards the taking of a life in the same way and, for example, not every nation recognises the phenomenon of mercy killing, any more than those that do so necessarily treat it identically.
So, when immigrants come to another country, they need to bear in mind not only the ways in which that country's laws and judicial requirements, processes and expectations might differ from those of their own but also that their new country's laws will also change from time to time. Such understanding is to some extent dependent not only upon their will but also upon their fluency in the new country's language; this is not dissimilar to the absorption factor that we note in immigrants generally, in which it is clear that some make efforts to merge with their new societies whereas others remain more aloof from it and try to stick with their own kind. One way to help in trying to overcome that problem is to persuade those who are not integrating well that the country already hosts many immigrants from many other countries; in many cases that will be a novel experience for them, since there is unlikely to be as large a proportion of immigrants in, say, Somalia, Yemen or Iraq as there is in most Western countries. This kind of thing can be something of an issue even between Western countries; I have noticed, for example (albeit not as an immigrant or would-be immigrant) that, in certain areas of rural France, for example, the proportion of immigrants is very low indeed and the number of countries from which immigrnats have come is similarly low, which is something that I had not anticipated and therefore found rather disconcerting on realising that almost everyone there is French.
Even issues that affect Islamic countries are not so black and white; radical Islam, which has been mentioned (much of which is arguably anti-Islamic in any case) is not subscribed to by everyone living in them any more than it is among Muslims who have already emigrated to Western countries - one has only to spend some time among the better educated young people in Iran's major cities to recognise this, although hard-line authorities there take a dim view of it and regard it suspiciously as incipient Westernisation.
So yes, it's a very complex set of issues, the best hope in respect of which is that immigrants at least make reasonable efforts to integrate into their chosen new societies. They will in any case make subtle changes to those socities over time merely by being present in them, without deliberately behaving as though they've not left the countries from which they've emigrated.
This is perhaps hardest of all for genuine refugees who have had everything taken away from them in their own countries, in some cases for a long time, before they emigrate. For example, an Afghan living not far from where I do had lost all of his family and been dispossessed in his own country for years before coming to UK, yet he has made sterling efforts to integrate not only with British people but also with immigrants from other countries. He has learnt English well, has managed to land a decently paid job and now regards himself as the UK citizen that he has legally become; he has also helped and encouraged other similarly dispossessed immigrants from Afghanistan and elsewhere to integrate into UK society. OK, he's been well educated before his tgerrible fate befell him in his country, so that has helped. It is people like him who have done so much despite having had nothing but his life for a very long time that make extremist statements such as "all immigrants are a drain on society" and the like all the more deplorable.
Best,
Alistair