OPINION
WOOD, Chief Judge.After defendant was convicted of armed robbery, the State filed a supplemental information seeking an enhanced sentence for defendant as an habitual offender. Section 40A-29-5, N.M.S.A.1953 (2nd Repl. Vol. 6). After trial on the supplemental information, defendant was found to have been convicted of tv/o felonies prior to the armed robbery conviction. Sentence of not less than fifty nor more than one hundred fifty years in the penitentiary was imposed. The appeal attacks the validity of the enhanced sentence. Defendant asserts the two prior felony convictions could not be used against him because they were constitutionally defective. The claimed defect is the absence of counsel at his preliminary examination in both prior felony convictions.
Assuming there were preliminary examinations in connection with the two prior felony convictions, defendant had a right to be represented by counsel at those examinations. State v. Vaughn, 74 N.M. 365, 393 P.2d 711 (1964); see State ex rel. Peters v. McIntosh, 80 N.M. 496, 458 P.2d 222 (1969); Coleman v. Alabama, 399 U.S. 1, 90 S.Ct. 1999, 26 L.Ed.2d 387 (1970).
Assuming further that defendant did not have counsel at those preliminary examinations, the absence of counsel would prevent the use of the prior convictions in imposing an enhanced sentence unless the right to counsel had been waived. Loper v. Beto, 405 U.S. 473, 92 S.Ct. 1014, 31 L.Ed.2d 374 (1972); United States v. Tucker, 404 U.S. 443, 92 S.Ct. 589, 30 L.Ed.2d 592 (1972); Burgett v. Texas, 389 U.S. 109, 88 S.Ct. 258, 19 L.Ed.2d 319 (1967).
Where a defendant enters a voluntary plea of guilty to the charge on which he is convicted, his plea waives defects and irregularities occurring prior to the plea. Christie v. Ninth Judicial District, 78 N.M. 469, 432 P.2d 825 (1967) and cases therein cited. Such a waiver includes the right to counsel at a preliminary examination. Neller v. State, 79 N.M. 528, 445 P.2d 949 (1968); State v. Tanner, 78 N.M. 519, 433 P.2d 498 (1967); State v. Robinson, 78 N.M. 420, 432 P.2d 264 (1967); Sanders v. Cox, 74 N.M. 524, 395 P.2d 353 (1964), cert. denied, 379 U.S. 978, 85 S.Ct. 680, 13 L.Ed.2d 569 (1965).
The record shows that in each of the two prior felony convictions, defendant first entered pleas of not guilty and subsequently changed his pleas to guilty. In each of the guilty pleas, defendant had the advice of counsel. The record does not show the pleas were involuntary and no such claim is made.
Defendant’s claimed defect was waived when he pled guilty in the two prior felony proceedings.
The judgment of the trial court is affirmed.
It is so ordered.
HENDLEY and HERNANDEZ, JJ., concur.