SALEM, Mass. (AP) -- A Massachusetts judge on Thursday dismissed charges against a Lynn man accused of kidnapping his 5-year-old son in 2008 and lying to investigators about the boy's disappearance.

Judge John Lu ruled that a state law dictates that the charges should be dismissed because Ernesto Gonzalez has been declared incompetent to stand trial because of mental illness and has served more than half the maximum sentence he would have received had he been convicted.

Gonzalez, 42, has been in jail since his son, Giovanni, disappeared in August 2008 during a weekend visit. The boy has never been found.

Gonzalez told a Boston Globe reporter that he had killed Giovanni and disposed of his body parts in trash containers throughout Lynn. Even though traces of the boy's blood were detected in Gonzalez's apartment, no other trace of the boy was found and no additional charges were ever filed.

Even though charges have been dismissed, Gonzalez will not go free any time soon. He has two other pending criminal cases and also is confined to a state psychiatric hospital under a civil commitment.

Gonzalez's lawyer, Russell Sobelman, argued for dismissal at a hearing last month. He said because Gonzalez has been in jail since August 2008, he has already served more than half of the 10-year maximum sentence he faced.

Essex Assistant District Attorney Jean Curran countered that dismissal would be "premature," because the clock should have started running last year when Gonzalez was first declared incompetent.

Giovanni's mother, Daisy Colon, said she believes Gonzalez has been playing the system and her son is still alive, perhaps with Gonzalez's relatives or friends.