An Australian grandmother who claimed she was tricked into carrying drugs into Malaysia after falling for an online romance scam Tuesday won her final appeal against the death penalty and will be freed.

Maria Elvira Pinto Exposto was arrested in December 2014 while in transit at Kuala Lumpur airport with 1.1 kilos (2.4 pounds) of crystal methamphetamine stitched into the compartment of a backpack she was carrying.

She was initially cleared of trafficking after a judge ruled in 2017 she did not know she was transporting the drugs, but the acquittal was overturned after prosecutors appealed and she was handed a death sentence.

Hugo Pinto Exposto (C), the son of Maria Elvira Pinto Exposto (not pictured), reacts after a Malaysian court overturned her death sentence for drug trafficking and ordered her release
Hugo Pinto Exposto (C), the son of Maria Elvira Pinto Exposto (not pictured), reacts after a Malaysian court overturned her death sentence for drug trafficking and ordered her release AFP / Mohd RASFAN

Capital punishment is mandatory in Muslim-majority Malaysia for anyone convicted of trafficking certain amounts of some controlled substances.

But the Federal Court in the administrative capital Putrajaya, the final court of appeal, overturned that decision and ordered her release.

"The appeal is allowed. The appellant is freed and discharged," said chief justice Tengku Maimun Tuan Mat.

The mother of four, who was stopped in Malaysia while heading to Australia, had claimed she was fooled into carrying the bag after travelling to China to see someone she met online called "Captain Daniel Smith", who claimed to be a US serviceman.