The guilty plea of a drug law offender should be vacated because it was entered under the mistaken belief that he would qualify for a shock incarceration program, a divided appeals court ruled Thursday.

The Appellate Division, Third Department, ruling 3-2 on a CPL 440.10 motion, said the defense attorney, prosecutor and judge all erroneously allowed Matthew Wiggins to plead to fourth-degree criminal possession of a controlled substance before Sullivan County Court Judge Michael McGuire.