An Iranian sailor held hostage by Somali pirates for more than four years has been released with the help of the United Nations and a humanitarian group, Iran’s Foreign Ministry said on Saturday.