Tehran: Baquer Namazi, an Iranian-American and former United Nations official imprisoned in Iran on charges of spying and cooperating with the US government, has been released, according to local media citing officials.

Namazi served at UNICEF as Representative for Somalia, Kenya and Egypt, among other positions. As per the official IRNA news agency on Sunday, the Iranian government released Namazi on humanitarian grounds.

Deputy Chief of the Iranian Judiciary Kazem Gharibabadi and secretary of the High Council for Human Rights as quoted by IRNA said that the former United Nations official was staying at his own home in Tehran, not in prison for nearly four years because of his health problems, was allowed to leave Iran anytime he wants.

On Wednesday, the ban on his leaving Iran was removed, following his requests for continuing his medical treatment outside the country, the official said.

Meanwhile, Siamak Namazi, the Baqer Namazi who was also imprisoned in Iran for nearly seven years on espionage-related charges rejected by the US as baseless, has been allowed out of Tehran's prison on a one-week furlough, IRNA news agency reported quoting Gharibabadi.

On Saturday, Stephane Dujarric, the spokesman of the UN Secretary-General, quoted UNSG as saying that Antonio Guterres has appreciated Iran's President Ebrahim Raisi for accepting his demand to release Baquer Namazi's to continue his treatment procedure overseas.

"The Secretary-General is grateful that, following his appeals to the President of the Islamic Republic of Iran, our former colleague Baquer Namazi has been permitted to leave Iran for medical treatment abroad," the statement read.

Dujarric also said that Baquer Namazi has been released from prison and left Iran, adding that Siamak Namazi has been also freed, but he is still in Iran.

"The Secretary-General is also pleased to learn that Baquer Namazi's son, Siamak Namazi, has been released from detention," it also read.

Guterres expressed satisfaction that Siamak has been released and that the UN will continue to consult with Iranian officials on a range of issues such as regional situation, sustainable development and support for human rights.

"We will continue to engage with the Iranian authorities on a range of important issues, including the regional situation, sustainable development and the promotion and protection of human rights," the statement further read.

According to IRNA news agency, Baquer and Siamak Namazi were arrested a few years ago on charges of spying and cooperating with the US government, and each was sentenced to 10 years of prison.