The earlier draft also required foreigners already living in Russia to be tested when renewing their visas, and stipulated that the testing be done in Russia -- a proposal that was vehemently opposed by Western embassies.

But the new version has also been criticized.

Russia's equivalent of an AIDS czar, Vadim Pokrovsky, head of the Center for Combating AIDS, condemned the law. "This will not help check the spread of AIDS, as many Russian citizens travel abroad," he said. "But it will prompt criticism from the world community."

The Russian law's requirements for foreigners are more stringent than those of most European countries, but they are not dramatically stricter than those of the United States. Foreigners who seek permanent residency in the United States are required to take a medical exam. If they are found to be H.I.V. positive, they are excluded unless they are granted a waiver. According to immigration officials, foreigners who seek a temporary visa are not asked if they are H.I.V. positive. However, when vistors declare that they are H.I.V. positive they can be denied a visa unless they are granted a waiver.

Unlike many European countries, the United States reserves the right to deport aliens who provide false information about whether they are H.I.V. positive. So did the Soviet Union, under a law signed in 1990 by Mikhail Gorbachev, which remains on the books until the new law goes into effect. Under the new law, foreigners who are found to be H.I.V. positive will also face deportation.

"Europe has the most progressive laws," said Kevin J. Gardner, an American working in Russia who is the head of a Russian AIDS organization, Aesop, which lobbied heavily against the new law. "This law will really hurt Russia's efforts to integrate with Western institutions."