President Obama on Friday signed into law a bill authored by Texas Republican Sen. Ted Cruz that would bar an Iranian diplomat from entering the United States, but immediately issued a statement saying he won't enforce it.

Obama decided to treat the law as mere advice. "Acts of espionage and terrorism against the United States and our allies are unquestionably problems of the utmost gravity, and I share the Congress's concern that individuals who have engaged in such activity may use the cover of diplomacy to gain access to our Nation," Obama said in his signing statement.

"Nevertheless, as President [ George H.W.] Bush also observed, "curtailing by statute my constitutional discretion to receive or reject ambassadors is neither a permissible nor a practical solution." I shall therefore continue to treat section 407, as originally enacted and as amended by S. 2195, as advisory in circumstances in which it would interfere with the exercise of this discretion."

Obama frequently criticized President George W. Bush for such signing statements during his 2008 campaign. “Congress's job is to pass legislation," he said, as The Daily Beast recalled. "The president can veto it or he can sign it.”

“It is unconscionable that, in the name of international diplomatic protocol, the United States would be forced to host a foreign national who showed a brutal disregard for the status of our diplomats when they were stationed in his country,” Cruz said when he introduced the bill.

The legislation was directed at Hamid Abutalebi, whom Iranian President Hassan Rouhani tapped as U.N. ambassador, because of his alleged role in the 1979 student takeover of the U.S. Embassy in Tehran, in which 52 Americans were held hostage for 444 days. Abutalebi insists his role was limited to translation and negotiation.

Iran has said it will not withdraw his name, and has asked the U.N. to investigate the U.S. visa denial.