Officials say a man who cheated the hangman at the gallows has been freed after 19 years on death row in Nigeria.

Thankgod Ebhos, 54, was dragged to the gallows and watched four fellow death-row inmates being hanged in June 2013. He was saved because prison officials realized that his sentence by a military tribunal called for him to be shot by a firing squad.

Human rights lawyers filed an appeal noting he had been convicted while the country was under a military dictatorship notorious for unfair trials and torturing confessions from prisoners.

A court of the Economic Community of West African states in June ruled that Ebhos should be freed.

Amnesty International said he was released from jail on Friday.

Nigeria had 1,039 people on death row last year.