The Court of Appeal has freed a teenager who killed a 12-year-old girl because there is no legal basis for detaining a child convicted of murder, reports said Thursday.

The boy, now 17, stabbed his teacher's 12-year-old daughter 24 times with a kitchen knife after she taunted him by calling him "'fatty."

But the appeal court's landmark decision means the teenager, who spent five years in prison after being convicted in 2003, goes free.

"We have no choice in the matter except to maintain the conviction and order the release of the appellant," the Star quoted appeals court judge Gopal Sri Ram as saying.

Sri Ram, who handed down the decision with two other judges, said the boy had committed "a most heinous crime" that would have resulted in the death penalty if it had been committed by an adult.

Attorney-General Abdul Gani Patail said the prosecution would file an appeal against the boy's release.

Amended needed

The boy's lawyer, Karpal Singh, called for the law to be changed because it allowed minors to walk free after committing murder.

"This has set a precedent. I urge the government to do something about it by moving a bill in parliament to amend ... the Child Act," Karpal told The New Straits Times .

He said the law should be amended to place minors at the pleasure of the court, which would allow judges to decide their fate. The boy, who cannot be named, was sentenced at the pleasure of the king.

Malaysia's Bar Council said the boy's release was a failure of the criminal justice system.

"No law is perfect, but parliament must ensure that this doesn't happen again," Bar Council vice-president Ragunath Kesavan told The Star .

The boy told reporters after his release that he wanted to become a lawyer "so that I can defend people who have the same fate, and those with a capital sentence."