McCarthy, J. Appeal from a judgment of the County Court of Cortland County (Campbell, J.), rendered April 26, 2012, which resentenced defendant following his conviction of the crimes of criminal sexual act in the second degree, rape in the second degree and rape in the third degree.
In 2010, defendant pleaded guilty to criminal sexual act in the second degree, rape in the second degree and rape in the third degree in satisfaction of a 31-count indictment. In accordance with his plea agreement, County Court sentenced defendant to an aggregate prison term of 10 years followed by 10 years of postrelease supervision. On appeal, this Court determined *1059that the imposed sentences were illegal because, at the time that defendant committed the crimes, the relevant statutes provided for indeterminate sentences, rather than determinate sentences, and did not authorize postrelease supervision (92 AD3d 1089, 1090 [2012]). Upon remittal, the People requested a resentence to an aggregate prison term of 6 to 18 years and indicated that if defendant did not accept that sentence, they would exercise their option to withdraw from the plea agreement. Defendant declined to withdraw his plea, but objected to the People’s recommendation. County Court resentenced him to an aggregate prison term of 6 to 18 years. Defendant appeals.
County Court violated double jeopardy principles when it imposed on defendant an aggregate sentence with a maximum of more than 10 years in prison. “[T]he key to double jeopardy analysis of a sentence increase is whether the defendant had a legitimate expectation in the finality of his [or her] original sentence” (Stewart v Scully, 925d 58, 63 [2d Cir 1991]; see People v Williams, 87 NY2d 1014, 1015 [1996]). A court violates double jeopardy principles if it subjects a defendant to a greater maximum sentence upon resentencing after the original agreed-upon sentence has been determined to be illegal (see Stewart v Scully, 925d at 63). At the time of resentencing, defendant had served two years of his 10-year prison sentence (compare id. at 64 [the defendant had legitimate expectation of finality where he had served three years of 20-year maximum]).* As defendant had a reasonable expectation of finality in the maximum term of his prison sentence, namely that he would serve no more than 10 years in prison, imposing a maximum prison term greater than 10 years would run afoul of the double jeopardy clause (see People v Campanella, 297 AD2d 642, 642-643 [2002]; People v Trimm, 252 AD2d 673, 675 [1998], lv denied 92 NY2d 931 [1998]; People v Gilchrist, 231 AD2d 424, 424 [1996], lv denied 89 NY2d 864 [1996]; see also People v White, 292 AD2d 158, 158-159 [2002]). Thus, we modify the resentence to an aggregate maximum of 10 years in prison.
Stein, J.R, Spain and Garry, JJ., concur. Ordered that the judgment is modified, on the law, by reducing the sentences imposed on counts 13, 15 and 16 of the indictment to 1 to 3 years, U/s to 4 years and 1 to 3 years, respectively, to be served consecutively, and, as so modified, affirmed.
The choice for defendant to accede to the People’s recommended sentence or withdraw his plea is somewhat illusory here, considering that he would be up for trial on 31 counts and had already served two years of his sentence.