Tensions mounted between Iran and the United States on Wednesday over a new American law that limits visa-free travel, which the Iranians regard as a sanction and a violation of the recently completed nuclear accord.

The Iranian foreign minister and Republican critics of Iran traded warnings about the visa law, which is barely a week old.

The law applies to foreigners who would otherwise be eligible to travel to the United States without a visa. It denies that privilege to anyone who has visited Iran in the past five years or who holds Iranian citizenship. The same restriction applies to citizens of or visitors to Syria, Iraq or Sudan.

The law is part of an American antiterrorism response to the recent attacks in Paris and San Bernardino, Calif., and is primarily directed at suspected members and supporters of the Islamic State, the extremist Sunni group that controls parts of Iraq and Syria. Sudan and Iran were included partly because they have been on the State Department’s list of state sponsors of terrorism for many years.