Baquer Namazi, left, and his son Siamak shown in an undated photo made available last year by Babak Namazi, Siamak Namazi’s brother. (Babak Namazi/AP)

Iranian authorities on Sunday granted a four-day prison leave to an ailing 81-year-old U.S. citizen convicted of espionage, and his family and U.S. officials expressed hope he will be allowed to return to the United States soon.

The temporary leave from Evin prison allowed Baquer Namazi to be released from a Tehran hospital where he was being treated for an irregular heartbeat and go to the house where his wife is staying, according to Jared Genser, an attorney for the Namazi family. According to officials, the family was required to post a hefty bail.

It is unknown whether Namazi will be forced to return to the prison when his leave expires on Thursday.

“It is unbearable for me to imagine my father may have to return to Evin prison in a few days when his health has been so rapidly deteriorating,” said his son, Babak Namazi. “I hang on to the hope that humanity will finally prevail.”

The temporary reprieve comes almost two years to the day after he was arrested when he came to Iran to try to secure the release of his son, Siamak, a businessman who had been arrested a few months earlier. Both men were eventually convicted of espionage and collaborating.

U.S. officials have been calling for their release since they were arrested. The apparent goodwill gesture was made just two weeks after President Trump decided not to reimpose nuclear-related sanctions suspended with the Iran deal but indicated that it was the last time he would waive them. Slapping the eased sanctions back on would put the United States in violation of the agreement and mean it was withdrawing from the deal.

Iran has arrested several foreigners on suspicion of being spies. Most are dual nationals, a category Iran does not recognize.

The United Nations, where Namazi worked as a UNICEF official, has repeatedly asked the Iranian government to release him and the other foreigners.

Although the Trump administration has few direct communications with Iran, Tom Shannon, the undersecretary for political affairs in the State Department, talked with Iranians last month during a routine meeting to monitor progress in the 2015 nuclear deal. At every such meeting, U.S. officials push for the release of at least five U.S. citizens who are held or went missing in Iran.

The case of Baquer Namazi was considered particularly urgent because his health problems have been severely exacerbated during his two years in prison. He has been hospitalized at least four times during the past year, most recently on Jan. 15 after his blood pressure plummeted. In September, he had a pacemaker installed during emergency surgery.

The United States has had no diplomatic relations with Iran since the Islamic revolution in 1979 brought clerics to power. The enmity thawed a bit under the Obama administration, which negotiated with five other world powers to get Iran to agree to curbs on its nuclear program in exchange for sanctions relief. But relations have deteriorated during the Trump administration, which has imposed many new sanctions on Iran for reasons not related to its nuclear program, including missile tests, human rights abuses and its support of radical groups in the region.

U.S. officials, communicating with the Iranian government through allies that have relations with Tehran, warned of the international condemnation that would come if the elder Namazi were to die while in Iran’s custody. The Namazis are well-known business executives, and friends and acquaintances consider the espionage charges to be bogus, intended only to gain leverage for a prisoner swap like the one that occurred simultaneously with the Iran deal’s implementation in 2016.

Gensler, the family attorney, said the four-day leave was approved after a government medical examiner talked with physicians at the hospital where Namazi was being treated. He said they told the examiner it would be “dangerous” for him to go back to prison.

“It's a good start,” said Steve Goldstein, the State Department’s undersecretary for public diplomacy. “But four days are not sufficient, and he committed no crime. To put Mr. Namazi back in prison would have a very detrimental effect on his health. We’re urging the Iranian government to continue its humanitarian effort and allow Mr. Namazi to leave the country to get proper medical care.”

The State Department called for Iran to release all U.S. citizens being held for alleged espionage.

“We welcome the release of Baquer Namazi given his deteriorating health but we note that his release is only temporary,” spokeswoman Heather Nauert said. “We call for the immediate and full release of the Namazi family, including his son Siamek, as well as other Americans unjustly held by the Iranian government.”

In addition to the Namazis, the Iranians have imprisoned a Princeton doctoral student, Xiyue Wang, and a dual national art gallery owner, Karan Vafadari. Nizar Zakka, a Lebanese citizen with permanent U.S. residency, also is imprisoned. U.S. officials are still pushing the Iranians to find out what happened to Robert Levinson, a former FBI agent who disappeared in Iran in 2007.