A 13-year-old boy who was handed a ten-year jail sentence for blasphemy last year will now walk free.
He was convicted by an Islamic court in August for making uncomplimentary remarks about Allah during an argument with a friend in northern Kano state.
A secular appeals court overturned the sentence on Thursday, saying the child was just a minor.
The shariah court sentence sparked international condemnation.
In September 120 volunteers offered to serve part of the 10-year jail sentence given to the boy.
The UN children’s agency, Unicef, said at the time the ruling “negated all core principles of child rights and child justice that Nigeria has signed on to”.
However, the authorities in Kano state appear unhappy with the dismissal of the case against the minor.
The state Attorney-General Musa Lawan told the BBC that they would consider appealing against the ruling.
The teenager’s parents have disassociated themselves from their son due to the shame his case has brought upon the family.
Kano is one of 12 Nigerian states practising the shariah legal system alongside the country’s secular laws.
Muslims form the majority in northern Nigeria, and only Muslims can be tried in shariah courts.
The appeals court has also ordered a retrial in another blasphemy case, involving singer Yahaya Sharif-Aminu, which has aroused more passion in Kano than the boy’s case.
The singer was sentenced to death by the shariah court for using lyrics deemed blasphemous against the Prophet and many are demanding his execution.