MOSCOW — In recent weeks, Russia has been engaged in a concerted effort to tame its habitual xenophobic demons in anticipation of 500,000 foreign soccer fans descending on the country for the World Cup that started Thursday. It has even organized classes on how to smile.

But some lawmakers apparently missed the memo.

One member of Parliament warned Russian women against sleeping with foreign men, especially if they were from a different race. Another cautioned even against hugging visitors from other continents, given that they might be rife with disease.

The ensuing outcry was loud and sharp, with many on social media comparing the remarks to propaganda during the 1980 Olympics, when the Soviet Union warned its citizens against talking to foreigners. (In that era, any talk of sex was strictly taboo.)

Russians, though often big-hearted, can be notoriously dour when dealing with foreigners, particularly large groups who do not speak the language.