By a writ of habeas corpus the relator challenges his present detention for trial on a charge of grand larceny in the first degree.
There is no dispute as to the facts. The relator was indicted for the crime of grand larceny in the first degree on two counts. On July 28, 1949, he was arraigned in the County Court of Kings County and pleaded not guilty. On September 8, 1949, he withdrew this plea and pleaded guilty to grand larceny in the first degree on the second count in the indictment. Thereafter the District Attorney filed an information charging relator with being a second felony offender because of a prior conviction by a court martial under the 94th Article of War. The relator challenged the sufficiency of the information on the ground that the former conviction was for an offense that did not constitute a felony under the laws of the State of New York and he accordingly requested permission to plead guilty to the charge of grand larceny in the second degree. The County Court, with the consent of the District Attorney, accepted this plea, but only upon the condition that the relator withdraw his challenge to the information charging him with being a second felony offender and simultaneously promise to waive all right to challenge said information. The relator agreed to the conditions and thereupon pleaded guilty to grand larceny in the second degree. On October 31, 1949, he was sentenced to a term of not less than five nor more than ten years in the State Prison as a second felony offender and has already served part of this term. On December 2, 1949, the Court of Appeals decided the case of People v. Olah (300 N. Y. 96, revg. the Appellate Division, 275 App. Div. 319) under which decision it became apparent that as a matter of law the relator was not a second felony offender. Consequently, on April 2, 1951, relator moved through his present counsel before the same Judge who sentenced him for resentence as a first offender. Ill other words, he challenged the information and thereby breached his promise. The court, with the consent of the District Attorney, thereupon set aside his sentence as a second felony offender but at the same time, and over the relator’s objection, also set aside the relator’s plea of guilty to grand larceny in the second degree. Apparently this action was based upon the fact that the relator had broken his promise. On June 22, 1951, the relator was *409arraigned on the original indictment, and his motion for resentence again heard and again denied. The relator then pleaded not guilty by reason of a former conviction and is now being-held in the city prison for trial on the original indictment.
Relator attacks his present confinement on the ground that he limited his motion to a demand for resentence only and that the court was therefore without power to set aside his reduced plea, and moreover, that even if the court had the power to set aside his reduced plea over his objection, double jeopardy would attach to his retrial for the same offense.
The question here presented is apparently one of first impression. It involves the power of the County Court to set aside the relator’s plea to the lesser degree of crime over his objection by reason of a broken promise. It has often been held that in the absence of fraud or deceit the court “ After judgment on a plea of guilty and the beginning of the term of imprisonment was without jurisdiction to permit the defendant to change his plea.” (Matter of Dodd v. Martin, 248 N. Y. 394, 396; see, also, Code Crim. Pro., § 337.) It would follow that in the absence of statutory authority the County Court, under similar circumstances, could not force or accept a change of plea upon its own order over the objection of either party. In Matter of Stebbins v. Sherwood (148 Misc. 763, affd. 241 App. Div. 615) the County Court, over the objection of the District Attorney, accepted a plea of the accused to a lesser crime than that charged in the indictment. A mandamus was granted compelling the County Court to accept a plea of guilty to the original charge and impose a sentence accordingly, the court remarking: ‘ ‘ The grand jury charged the defendant with assault in the first degree, and the defendant saw fit to plead not guilty. The indictment and the plea were the pleadings, and by these the issue was formed. The County Court was without power to alter this issue over the objection of either of the parties.” (P. 765.) Again, in Matter of McDonald v. Sobel (272 App. Div. 455, affd. 297 N. Y. 679), the Appellate Division in this department held that the County Court was without power to accept over the objection of the District Attorney a plea of guilty to a lesser crime than that charged, stating on page 457: 11 The authority for the exercise by a County Judge of power to make an order in a criminal case must be found in the Code of Criminal Procedure. Power must be conferred upon him expressly or impliedly by statute. (People ex rel. Hirschberg v. Orange Co. Ct., 271 Ñ. Y. 151, 155.) ” and later, at page 461: “ It thus appears, limiting inquiry to the language of the statutes invoked, that the County *410Court was without power to do that which it did herein and that its act was a nullity. ’ ’ (Italics supplied.) From these and other authorities it appears that the act of the County Court in this case setting aside the relator’s reduced plea was a nullity unless it can he established that fraud or trickery was practiced upon it. Such lack of power under the circumstances is tantamount to a lack of jurisdiction. For instance, it has been said by the Court of Appeals that ‘ ‘ If the relator’s sentence is for a term longer than authorized by statute it is not a judgment of a court of competent jurisdiction even though the sentencing court had power to try the offense and fix the penalty.” (People ex rel. Carollo v. Brophy, 294 N. Y. 540, 542; see, also, People ex rel. Miresi v. Murphy, 253 App. Div. 441.)
The District Attorney argues that the County Court was warranted in setting aside relator’s plea under its inherent-power “ to reopen its judgment where the same was based upon trickery, deceit, coercion or fraud and misrepresentation in the procurement of the plea upon which the judgment was based. ’ ’ (Matter of Lyons v. Goldstein, 290 N. Y. 19, 26; People v. Siciliano, 185 Misc. 149; see, also, People v. Gowashy, 244 N. Y. 451, 465, and People v. Chichester, 262 App. Div. 567.) These cases all involved defendants who had been tricked or misled into filing pleas upon promises of the District Attorney. To deny a defendant the right to reopen such a judgment against him might well have impaired his rights under the due process clauses of the Constitutions of the United States and of the State of New York. The rights of the State are not equally protected; but there appears to be no reason why fair play and the orderly administration of justice would not justify the exercise of the same inherent power of the court where the State has been tricked or defrauded. Great reliance is accordingly placed by the District Attorney upon the case of People ex rel. Bocchetti v. Wallack (269 App. Div. 888, motion for leave to appeal denied 295 N. Y. 991). In that case the defendant was indicted for robbery in the first degree, and upon his arraignment on October 20,1938, the District Attorney agreed to accept a plea of grand larceny in the second degree upon the statement of the defendant that he had been previously convicted of grand larceny. Judgment and sentence was deferred until October 24, 1938, upon which date the District Attorney, having learned that the defendant’s previous conviction was for a misdemeanor, stated that he was unwilling to accept the reduced plea. Defendant then pleaded not guilty and the proceeding was adjourned to November 21st, when the defendant pleaded guilty to grand *411larceny, first degree, and the court pronounced judgment and sentence. By a writ of habeas corpus the defendant then attacked his conviction and incarceration asserting that he was twice placed in jeopardy. The order of the Special Term dismissing the writ was affirmed on the ground that the court had inherent power to set aside the reduced plea because of the misstatement and deceit practiced by the defendant. In passing, it is to be noted that the plea in that case was set aside during the same term, although this may have been immaterial.
The court does not believe the Bocchetti case is controlling because the facts in that case differ. Here there has been no fraud, misrepresentation or trickery. The County Court and the District Attorney were well aware that the relator’s promise could not be enforced if it was subsequently determined that in fact the relator was not a second offender. According to the District Attorney’s affidavit, the County Court at the time it exacted the promise from the relator stated: “If the challenge to the information is withdrawn, I will reduce the plea, although I don’t think there is any merit to the challenge anyhow.” In the same document the District Attorney asserts: “In this instance, the consideration was one which under the development of the law as laid down subsequent to the original contract and by the Olah case, became shall we say, illegal.” Under such circumstances it cannot be claimed that the relator tricked, deceived or defrauded the court or the District Attorney into accepting his reduced plea. He broke his promise but this was not deception.
The issue then is whether the principle of the Bocchetti case shall be extended to empower the court to set aside a reduced plea upon the failure of the relator to perform a promise which could not be legally enforced. No statute or other legal sanction has been called to the attention of this court in support of such a proposition. Unless such power is expressed or implied in the statute or is inherent in the court, it does not exist. Although the relator may benefit by his breach of promise the court being without power to act, took that risk at the time it exacted the promise. Such conclusion in this case happens to be in harmony also with the general principle of contract law that no court should lend its aid in the enforcement of or recovery under an illegal contract (see 1 Clark on New York Law of Contracts, § 641).
The relator has raised the question of double jeopardy. He contends that even if the County Court had the power to act, as it did, a retrial of the relator under the circumstances would *412twice place Mm in jeopardy in violation of the Fifth Amendment of the Constitution of the United States, and section 6 of article I of the Constitution of the State of New York. There can be no doubt that the court had the power to set aside the original sentence at any time for illegality and to thereafter resentence the relator (see People ex rel. Miressi v. Murphy, 253 App. Div. 441, supra). The infliction of a new sentence on the relator under these conditions would not twice place him in jeopardy (People v. MacKenna, 298 N. Y. 494). The relator does not challenge these principles. He also denies that the present situation has been brought about by his own conduct. If the relator had moved to set aside his reduced plea he would have been in the same situation as a defendant who was successful in obtaining a reversal of a judgment of conviction upon a pleading. In that case he would have voluntarily placed himself in jeopardy and he would not have been able to invoke the Constitution in his behalf for immunity (People v. McGrath, 202 N. Y. 445; People ex rel. Ostwald v. Craver, 188 Misc. 5, affd. 272 App. Div. 181). Eelator, however, moved only to set aside his sentence, the cancellation of which did not destroy his reduced plea- or his conviction. The court over his objection, and not he, set aside the plea. When the sentence was voided the relator stood before the court as one who had never been sentenced for the felony to which he had pleaded guilty (People v. MacKenna, 298 N. Y. 494, supra). Until legally set aside, that plea was as effective as if there had been a conviction by the verdict of a jury. In People ex rel. Hubert v. Kaiser (206 N. Y. 46, 52) the court said: “ The record produced showed that he had withdrawn his plea of not guilty and had pleaded guilty, and continued to stand at the bar of the court upon that plea. That was as effective, as if there had been a conviction by the verdict of a jury and, if not withdrawn, required the court to pronounce judgment.” Even though no judgment is rendered upon a conviction so obtained, it may be pleaded as a former conviction upon an indictment for the same offense (People v. Goldstein, 32 Cal. 432; 1 Bishop on Criminal Law, § 1049).
Assuming the County Court had the power to set aside the relator’s plea but acted without authority or erroneously, there would then be no authority to hold the relator and he would have to be discharged. In People ex rel. Ostwald v. Craver (supra) the defendant was convicted of a crime and sentenced to prison. Thereafter, on motion of the District Attorney, the verdict and judgment were erroneously set aside and a new trial ordered. *413The defendant was discharged on a writ of habeas corpus upon the ground that the new trial would place him in jeopardy twice for the same offense. That the relator cannot be twice placed in jeopardy for the same offense is too well settled to require discussion (People ex rel. Stabile v. Warden of City Prison, 202 N. Y. 138; People ex rel. Meyer v. Warden of Nassau Co. Jail, 269 N. Y. 426; People v. Goldfarb, 152 App. Div. 870, affd. 213 N. Y. 664). This is true whether the court is satisfied with the conviction or not (1 Cooley on Constitutional Limitations [8th’ed.], pp. 685-686). It becomes evident that fraud and trickery being absent, a retrial in this case of the relator upon the charge of grand larceny in the first degree would again place him involuntarily in jeopardy for the same offense. If the order of the County Court setting aside the relator’s reduced plea is a nullity — and this court holds that it is — then the reduced plea stands. While there can be no power or authority to place the relator again on trial for the same offense under the original indictment, he may be held for resentencing under his reduced plea which is still valid.
The availability of the writ of habeas corpus in this case has been seriously questioned. There is ample authority to the effect that the writ may be employed to test the legality of the detention of a defendant held for retrial after he has once been placed in jeopardy for the same offense. (See People ex rel. Bullock v. Hayes, 215 N. Y. 172; People ex rel. Ostwald v. Craver, supra, and People ex rel. Ticeneto v. Brewster, 241 App. Div. 467.) Upon such a writ the court has not the power to review the legality of the decision or the procedure of a court of competent jurisdiction (People ex rel. Hubert v. Kaiser, 206 N. Y. 46, supra; People ex rel. Tweed v. Liscomb, 60 N. Y. 559). Tin-court does have the right, however, in such a proceeding to inquire into the power or jurisdiction of the court before whom the relator appears, to proceed further and pronounce judgment (People ex rel. Hubert v. Kaiser, supra). In People ex rel. Tweed v. Liscomb (supra), the court pointed out that the prohibition of the habeas corpus act regarding inquiry into the legality of previous judgments or decrees did not take away from the court the power or duty to determine “ whether the court making the judgment or decree, or issuing the process, had the legal and constitutional power to give such judgment, or send forth such process ” (p. 570). If the County Court had no po'wer to set aside relator’s reduced plea, then a judgment rendered upon his proposed retrial under the original indictment would not be a judgment of a court of competent jurisdiction *414(People ex rel. Carollo v. Brophy, 294 N. Y. 540, 542). Detention for the purpose of subjecting relator to such a trial would be an illegal detention. The District Attorney cites the Bocchetti case (supra) as authority for the principle that only the legality of the procedure and of the decision of the County Court is involved in this proceeding and hence the writ of habeas corpus does not properly lie. The difference between that case and the present one has already been explained. There is no doubt that in the Bocchetti case the court had power to act. The only issue involved was the legality of the procedure. That is not this case because this court finds that the County Court had no power to act in the premises. Accordingly the detention of the relator for retrial is illegal. Since the reduced plea validly remains, detention for the purpose of resentencing the relator is legal. Foi that purpose, relator should be remanded (People v. Garcia, 272 App. Div. 1084). The writ is sustained in accordance with the above.