Both were denied access to legal representation, could not confront their accusers and have had health problems while imprisoned, Mr. Genser said. Both have been held in solitary confinement, the son has been tortured, and the father has a serious heart condition, he said.

The United Nations opinion said the “deprivation of liberty” by the Iranian authorities had violated the Universal Declaration of Human Rights and the International Covenant on Civil and Political Rights.

“The working group requests the government of Iran to take the steps necessary to remedy the situation,” the opinion said. The remedy, it said, was to release the Namazis “immediately and accord them an enforceable right to compensation and other reparations, in accordance with international law.”

Mr. Genser said the opinion validated his assertion that “it is time for Iran to resolve these cases and allow the Namazis to be reunited with their family.”

The lawyer, who is based in Washington, said he received the opinion, dated Aug. 22, in a letter from the working group this month that urged him to treat it “with discretion.” The Iran government also received a copy.

When the opinion will be posted on the United Nations website remains unclear.

Iran had no immediate response to the opinion. Officials there have said previously that their judiciary operates independently and that under the country’s laws, Iranian-American prisoners are considered Iranian citizens, with none of the consular rights afforded to foreign prisoners.

Mr. Rouhani’s visit to the United Nations also has been seen by advocates of Mr. Wang as an opportunity to press for his release. Mr. Wang, 37, a naturalized American from Beijing who is an avid scholar of Persian history, had been doing research for a doctoral thesis in Iran last year when he was arrested on espionage charges after having examined public archives. His incarceration, which Princeton knew about but kept quiet for fear of further imperiling him, was not disclosed until July, when Iran said he had been convicted and sentenced to 10 years.