
419 P.2d 216 (1966)
77 N.M. 1
STATE of New Mexico, Plaintiff-Appellee,
v.
Kenneth D. TIPTON, Defendant-Appellant.
No. 8180.
Supreme Court of New Mexico.
October 10, 1966.
Dan B. Buzzard, Clovis, for appellant.
Boston E. Witt, Atty. Gen., Gary O. O'Dowd, Asst. Atty. Gen., for appellee.


*217 OPINION
JOE W. WOOD, Judge, Court of Appeals.
State v. Tipton, 73 N.M. 24, 385 P.2d 355, affirmed the judgment imposing an increased sentence upon defendant as an habitual offender. This appeal is from the order denying defendant's motion to set aside the judgment and sentence under § 21-1-1(93), N.M.S.A. 1953. This appeal raises issues not presented in the prior appeal.
The motion listed sixteen grounds as a basis for relief. Independently of his court-appointed counsel, defendant asks that we review all grounds set forth in his motion. We do so.
The grounds not asserted by counsel divide into two categories. The first category consists of an objection to the philosophy behind habitual offender statutes and an objection that the habitual offender act should have been applied to him. This sets forth no basis for relief.
The second category claims various defects in the proceedings prior to his plea of guilty to the second felony. None of the defects now claimed were raised in the habitual offender proceeding as a collateral attack on the second felony proceeding. See State v. Dalrymple, 75 N.M. 514, 407 P.2d 356. In the habitual offender proceeding he was represented by competent counsel. He pleaded not guilty and went to trial on the habitual offender charge without asserting any defense on the basis of these claimed defects. By so proceeding, he waived the right to object to them. State v. Blackwell, 76 N.M. 445, 415 P.2d 563.
Counsel contends: (1) the information charging defendant as an habitual offender fails to state a crime and (2) there is no factual basis to show that he had been twice convicted or sentenced under § 41-16-4, N.M.S.A. 1953. Both points relate to the second felony.
The part of the information charging the second felony reads: "He entered a plea of guilty to the crime of rape of a female adult * * *" Defendant stipulated that he pleaded guilty to this crime.
The proceeding was under § 41-16-4, N.M.S.A. 1953, now repealed. That section required a "conviction" of prior felonies before the higher penalties could be imposed. Counsel asserts that a guilty plea is not the same as a conviction.
No sentence had been imposed for the second felony. However, by defendant's plea of guilty, he was legally convicted of the second felony. French v. Cox, 74 N.M. 593, 396 P.2d 423. The information sufficiently charged conviction of a second felony. The stipulation that defendant had pleaded guilty sufficiently established the second felony conviction as a fact.
Counsel points out that the second felony conviction was in Curry County Cause No. 5141. The information charging defendant as an habitual offender was filed as a separate cause and is Curry County Cause No. 5154. Such a separate proceeding is permissible where the only issue is the identity of the accused as the person previously convicted of crimes within the meaning of the habitual offender act. Lott v. Cox, 75 N.M. 102, 401 P.2d 93. Even though the identity is determined in a separate cause, the enhanced sentence may only be imposed in the last case in which the accused was convicted of a felony in this state. French v. Cox, supra; Lott v. Cox, supra.
Here, defendant's identity as the person previously convicted of two felonies was established in No. 5154, a separate proceeding. The enhanced sentence was also imposed in No. 5154. The sentence in No. 5154 was a nullity and the commitment issued therein is void. French v. Cox, supra; Lott v. Cox, supra. The sentence should have been imposed in the last felony case, which is No. 5141.
Defendant has been legally convicted in No. 5141, but no judgment or sentence has been imposed in that cause. Defendant's identity as an habitual offender *218 has been established in No. 5154. Defendant's restraint is illegal because sentence was imposed in the wrong case. In such a situation, defendant may be returned to the trial court for imposition of a proper sentence. French v. Cox, supra; Miller v. Cox, 75 N.M. 65, 400 P.2d 480.
The case is remanded to the trial court with instructions to vacate the sentence and commitment in No. 5154 and to enter its judgment imposing sentence upon defendant as an habitual offender in No. 5141.
It is so ordered.
NOBLE and COMPTON, JJ., concur.
