Image copyright Center for Human Rights in Iran Image caption Saeed Malekpour's death sentence was commuted to life imprisonment

An Iranian-born Canadian resident has escaped from Iran after being imprisoned there for 11 years and returned to Canada.

Saeed Malekpour was sentenced to life in prison over a programme he created for uploading photos to the web that Iranian authorities said was used on Persian-language pornographic websites.

His sister posted a video online showing his return to Canada on Friday.

He fled while on short-term release from prison.

Mr Malekpour's imprisonment was one of several prominent cases involving Iranians with dual nationality or foreign permanent residency.

In comments shared by the Iranian judiciary's official news agency Mizan Online, spokesman Gholamhossein Esmaili said Mr Malekpour was on a "three-day prison leave" and "barred from leaving the country".

"Apparently he has used illegal ways to leave the country," Mr Esmaili added.

Payam Akhavan, an international law professor who has been involved in the case, told Canadian media: "He was temporarily released from prison in Iran following pressure from United Nations human rights bodies, and he was to report to the prison authorities again.

"But instead he left the country and came to Canada through a third country."

Mr Malekpour's sister posted a video of him arriving in Canada on social media.

"The nightmare is finally over. He is back home and reunited with his sister. Thank you Canada for your leadership," she wrote.

She did not provide details of the circumstances surrounding his return.

The web programmer was arrested in October 2008 while visiting his father, who was in poor health, in Iran.

He argued that the programme he created was open source and that it was used by other websites without his knowledge.

He was initially sentenced to death for "spreading corruption on earth". This was later commuted to life imprisonment, reportedly after he "repented".

During his imprisonment, Mr Malekpour was physically and psychologically tortured and spent more than a year in solitary confinement, according to Amnesty International.