Correction: An earlier version of this article misidentified the state Sen. Ted Cruz represents as Florida. This version has been corrected.

This Feb. 6, 2014 photo, provided by the office of the Iranian President, shows Hamid Aboutalebi, an Iranian diplomat, who was recently named as Iran's ambassador to the United Nations. President Obama has signed a new law aimed at blocking a U.S. visa for him. (Mohammad Berno/AP)

President Obama on Friday signed a law barring the U.S. government from providing a visa to any nominee to the United Nations deemed to have engaged in terrorist activity, a measure aimed at blocking Iran’s preferred ambassador to the world body.

The move came a week after the Obama administration said it would not grant a visa to Hamid Aboutalebi, Iran’s choice as envoy.

The measure unanimously passed the Senate this month. In a statement, Obama said he shared Congress’s concern that individuals who have engaged in terrorism “may use the cover of diplomacy” to gain entry to the United States. But he added that he believes “curtailing by statute my constitutional discretion to receive or reject ambassadors is neither a permissible nor a practical solution.”

As a result, he said, he would treat the ban as “advisory in circumstances in which it would interfere with the exercise of this discretion.”

The law is sure to escalate tensions between Iran and the United States. Iran formally complained about the denial of Aboutalebi’s visato the United Nations, sending a delegation to meet with its office of legal affairs earlier this week.

In a letter sent to the United Nation’s 19-nation Committee on Relations with the Host Country, Iran said the United States is violating its option under a treaty that allows diplomats to enter the country.

Aboutalebi has admitted that he worked with an organization that stormed the U.S. Embassy in Tehran in 1979 and held 52 Americans hostage for 444 days as part of the Iran hostage crisis. But he has said he served in a minor role, as a translator.

The White House described Aboutalebi’s nomination to the U.N. post by Iranian President Hassan Rouhani as “extremely troubling.”

The law Obama signed Friday amends part of the Foreign Relations Authorization Act for the Fiscal Years 1990 and 1991, which was signed by President George H.W. Bush.

The bill was sponsored by Ted Cruz. It’s the first bill sponsored by the Texas Republican and presumptive 2016 presidential candidate that Obama has signed.