Judgment, Supreme Court, New York County (Daniel FitzGerald, J., at jury trial; Edward McLaughlin, J., at plea and sentence), rendered July 9, 2001, convicting defendant, after a jury trial, of petit larceny, and upon his plea of guilty, of at*219tempted robbery in the second degree, and sentencing him, as a second felony offender, to concurrent terms of one year and four years, respectively, unanimously modified, as a matter of discretion in the interest of justice, to the extent of reducing the sentence on the attempted robbery conviction to three years, and otherwise affirmed.
After a joint jury trial, defendant and his codefendant were convicted of petit larceny but the jury disagreed as to attempted robbery. Thereafter, the plea and sentencing court insisted upon a plea arrangement under which defendant was to receive a sentence of either three or four years depending on whether the codefendant pleaded guilty. The codefendant proceeded to a second trial and was convicted, and defendant was accordingly sentenced to four years. We find that it was improper to link defendant’s negotiated sentence, as opposed to a plea, to the codefendant’s decision whether to plead guilty. The legitimate purpose that linked plea agreements serve, that is, saving the State the expense and uncertainty of a trial, can be achieved only if all codefendants plead guilty (see People v Fiumefreddo, 82 NY2d 536 [1993]). However, in this case, since defendant was permitted to plead guilty whether or not his codefendant pleaded guilty, that purpose was not implicated. In effect, defendant received an enhanced sentence for the codefendant’s decision to proceed to trial, and this sentencing condition served no legitimate public purpose (compare People v Avery, 85 NY2d 503 [1995]).
Since it is clear that defendant’s plea was knowing, intelligent and voluntary, there is no reason to vacate the plea. Instead, an appropriate remedy would be to reduce the sentence to the lawful, bargained-for term of three years (see People v Wein, 294 AD 2d 78, 89-90 [2002]). Concur—Nardelli, J.P., Tom, Mazzarelli and Ellerin, JJ.