The opinion of the court was delivered by
Appellant was convicted of manslaughter in the first degree (K. S. A. 21-407) in connection with the death on February *7015, 1967, of Mrs. Lillie Mae Colbert of Coffeyville, Kansas. This was appellant’s third trial on a charge of first degree murder. (An additional count of rape was dismissed at the preliminary hearing.) The first trial ended in a mistrial when a juror died, and the second when the jury was unable to agree on a verdict. After appellant’s motion for a new trial was overruled the state, pursuant to previous notice, introduced evidence of three prior felony convictions. Appellant was thereupon sentenced to life imprisonment undejr K. S. A. 21-107a. He subsequently filed a motion for resentencing, contending that the prior convictions relied upon in imposing sentence under the habitual criminal act were invalid. This motion was overruled and he thereafter perfected this appeal.
The evidence indicates that on Saturday night, February 4, 1967, the appellant, the deceased, and four friends engaged in various social activities in the city of Coffeyville, involving dining, drinking, dancing and driving around. In due course they determined to go to Independence where dancing was available at an institution aptly named the 24 Hour Club, and proceeded there in appellant’s automobile, arriving at about 11:30 p. m. The passengers, in addition to the deceased, were Mr. and Mrs. Herbert Martin, and Mr. and Mrs. Leonard White.
During their stay in Independence appellant, according to his testimony, attempted to keep a date with a married woman he had been going with in Independence. When she was not at the club he drove to her house and observed her watching television with her husband. She waved him on, so he went back to the club and waited. When she failed to appear within half an hour he went to her house again and found the couple still engaged in the same Saturday night pastime. A third visit found the house dark, and appellant gave up for the night. At about 4:30 a. m. on Sunday, February 5, the original six embarked in appellant’s automobile for Coffeyville. As they left Independence they passed over a rough railroad crossing which apparently knocked one of two mufflers off of appellant’s car. The party nevertheless proceeded to Coffeyville with the car making abnormally loud noises.
All the testimony indicates that the first stop on returning to Coffeyville was to let the Whites out at their residence and that the second stop was to let the Martins out at theirs. The subsequent events of those early morning horns are the subject of conflicting stories but it would appear that that was the last time the deceased *702was seen alive by anyone other than the immediate participants in the ensuing tragedy.
The deceased, although married, had been separated from her husband for approximately two years prior to her death. During this period she had been carrying on an active affair with Herbert Martin, clandestine only to the extent that apparently Mrs. Martin was not aware of it. A sister of the deceased, the appellant, and various friends were privy to the affair, some to the extent of providing transportation to and accommodations for numerous trysts.
Martin testified that shortly after going to bed on the fatal Sunday morning he awoke and wanted a cigarette. Finding none in his house he drove to the Y. W. C. A. and bought a pack. After doing so, he proceeded to the house of one Phyllis Lee, which had been a regular place of assignation, to see if the deceased might be there. Not finding her, he phoned her house and got no response. At the deceased’s home his knocking on the door was likewise fruitless. He then proceeded to the house of Rose Lloyd, deceased’s sister, and found she was not there either. At this point he gave up his amorous quest and returned home. Both Rose Lloyd and Phyllis Lee testified to Martin’s arrival at their respective houses before dawn.
The activities of the appellant from approximately 5:00 a. m. until 8:00 a. m. can be ascertained only from the various accounts given by him on different occasions. At the latter time, however, he was observed entering his house by Allen Flowers, a detective in the Coffeyville police department, who was acquainted with him. Flowers was particularly conscious of the time because he was late to work and had left his home at 7:30 a. m. He noticed that the appellant had dirt on his clothes, and particularly his sport jacket, a fact that impressed him because appellant was known as a natty dresser.
When the deceased failed to appear at her home on Sunday, her family and friends met that evening to discuss the situation. At that time appellant stated that, after dropping the Martins off he had driven away with the deceased but returned shortly thereafter and let her off at the Martin house. The last he saw of her, he said, was when she was on the porch of the Martin residence.
Upon being notified of the fact the Coffeyville police department commenced an investigation of the disappearance of the deceased. In the course of this investigation two detectives, including Flowers, met with the appellant on February 17, in Independence, where he *703worked at a dry cleaning establishment. They interrogated him as to his activities on the night and morning of the disappearance and received from him substantially the same story he had previously told the deceased’s family and friends.
He added that on first returning to the Martin residence Herb’s car was gone and they spent some time driving around looking for him. They returned at the insistence of the deceased to get some money from Mrs. Martin which belonged to appellant. Again, the last he saw of her was when she went up the Martin’s steps. The money, he said, could wait until the next day — when all parties intended to go to church.
His explanation for the dirt on his clothes was that he had gotten down on the ground to look under his car in an effort to locate the source of the noise. He further related that after changing clothes on Sunday morning, he had returned to Independence to look for his missing muffler. His search was unsuccessful and while driving around in Independence he fell asleep at the wheel and had a collision with a parked car. At the time this statement was given, appellant was living in Independence, since his car was disabled and he no longer had transportation from Coffeyville to his job.
About a week later, on February 25, 1967, the body of the deceased was discovered accidentally in a dry creek bed in a wooded area approximately seven miles southwest of Coffeyville by a passerby who was searching for water for his overheated truck. He reported his find to the authorities and the Montgomery County sheriff and other officers proceeded to the scene. The deceased’s body was largely covered by brush, dirt and leaves, with only the legs exposed to view. A wig, identified as the deceased’s, was discovered covered by leaves approximately twenty to twenty-five feet from the body.
A pathologist examined the body at the scene and later performed an autopsy which revealed approximately twenty-one stab wounds, together with subarachnoid and subdural hemorrhages, consistent with her head having hit a solid or fixed object. Death was attributed to a combination of the head wounds and loss of blood from the stab wounds, although no one of the injuries would have caused death by itself, and in his opinion she might well have survived had she received immediate medical attention. His examination also revealed that she had had sexual intercourse, probably within twenty-four hours and certainly no more than seventy-two hours prior to her death.
*704The body of the deceased was fully clothed except for shoes. A handbag which witnesses had seen her carrying earlier was never found nor was any weapon.
One further significant item of evidence appeared on March 7, 1967. Prior to the discovery of the body the owner of the land on which it was found had observed a man’s plaid shirt lying on the ground. Thinking it belonged to a neighbor, he had picked it up and had hung it in his bam, giving it no further thought. On March 7, he happened to look at the shirt and observed spots which appeared to him to be blood, whereupon he called the sheriff. This shirt was positively identified as belonging to the appellant by Rose Lloyd. Her identification was based on a tear in the collar which she had inflicted during the course of a lovers’ quarrel with the appellant at a time when she had been having an affair with him. The site of its recovery was determined to be approximately halfway between the wig and the body.
Testifying in his own behalf appellant identified the shirt as his, saying that from the time it was torn he kept it in his car as a dust rag. He testified that he had given it to the deceased in Independence to keep her warm on the return trip. In a prior statement, to be discussed later, he gave an entirely different account.
On February 27, 1967, two days after the body had been found, two special agents of the Kansas Bureau of Investigation interviewed the appellant in Independence. The testimony of Agent Ronald Klingenberg is summarized in appellant’s abstract:
“We took him to the Dairy Delight, an eating place and interviewed him there in the car. I advised Mr. Melton of his constitutional rights and in so doing, I advised him that he had the right to remain silent, that anything he said could be used against him in a court of law, and he had the right to have an attorney present during the interview and if he couldn’t afford an attorney, one would be appointed for him to represent him during this interview. I asked him, with these rights in mind, if he wished to talk with me about the Lillie Mae Colbert case. He advised that he did, and wanted to cooperate in any way that he could.”
Appellant’s account of events was substantially the same as his previous accounts to deceased’s family and friends and to the Coffey-ville detectives. Appellant agreed at this time to make a statement at the county attorney’s office a few days later, but failed to keep this appointment.
Agent Klingenberg’s next significant encounter with the appellant occurred some five months later, on July 20, 1967, in the county jail *705in Tulsa, Oklahoma, where appellant was being held on Oklahoma charges of rape and robbery. He once again advised appellant as to his rights, and again received an assurance of cooperation. Appellant’s account coincided with his prior statements with one significant exception: this time he stated that when he and the deceased returned to the Martin home, Herbert Martin was there and asked to borrow appellant’s car. He agreed to this and Martin and the deceased drove off while he waited in Martin’s car for approximately an hour and a half. Martin returned alone, gave appellant back his car, whereupon appellant went home. Arrangements were made for another statement, and on July 24, 1967, Agent Klingenberg returned to Tulsa in the company of Agent Floyd Gaunt for this purpose.
Klingenberg again advised appellant of his rights and, according to his testimony, “At this time Melton said that this was something he felt he had to do and didn’t need an attorney present to do it.” Appellant’s story at this final and crucial statement was that, after leaving the Martin house, he took the deceased to her home, and there encountered a boyfriend of hers from Joplin, Missouri, whose name appellant didn’t know. This boyfriend wanted to talk to the deceased so the appellant got into the back seat and the anonymous boyfriend drove the three of them in appellant’s car to a point approximately five and one-half miles south and west of Coffeyville and parked on a curve near a junk pile. Klingenberg continued:
“There an argument occurred between this boyfriend and Lillie Mae about Lillie Mae seeing Herbert Martin. Maurice said he got out of the car and walked East up the road to the comer. I asked him if he recalled going over a bridge and he stated that he walked over a bridge to the corner. At this time a diagram of the road area was sketched. I asked Maurice if this looked like the area that he was referring to and he stated ‘Yes’. I asked him to mark approximately where the car was parked and he did pick up the pen and mark where the car was parked by the junk pile. Maurice stated that he heard some violent arguing in the road near the bridge. It was just getting daylight. He could see Lillie Mae and this man in the road, apparently hitting one another with their fists during the argument about Herbert Martin being a lover of Lillie Mae. Melton stated he went back to see what the trouble was or if he could calm them down and he saw this ‘unknown man’ stabbing Lillie Mae with a knife and then Lillie Mae turned and ran across the ditch in a northerly direction, crossed the fence, and this guy was chasing her and he got her over in the area where Lillie Mae’s body was later found.
“. . . Continuing his testimony the witness stated that he ran- over there and watched this guy stab Lillie Mae a number of times about the upper *706left portion of her body. He saw Lillie Mae lacking and screaming and bleeding, then he returned to his car, turned it around and parked near the bridge and waited for the other guy to come over to the car. This man came to the car, and they drove back to Coffeyville where the man got into his own car parked about one door down from Maurice Melton’s home. I asked Maurice if he made any attempt to assist Lillie Mae and he stated that he did not, he merely watched as it was none of his business, whatever they were arguing about, or doing to one another. I asked him if he realized this man he had been shielding was actually the killer of Lillie Mae and he stated he realized this from the locations and conditions of the wounds. I asked him if he realized that his shirt was found near the body and he stated that on his way out to the location, Lillie Mae was chilly so he took his shirt from the back seat of the car and put it over Lillie Mae’s shoulders. I asked Maurice if the boyfriend had asked him to inflict some wounds on Lillie Mae’s body to make him an accomplice to this crime; and he stated that he had not. I asked him if he or the boyfriend had sexual relations that evening and Maurice denied having any relations with Lillie Mae, ever, and especially that night. He further stated he had no knowledge of whether the boyfriend had or had not, but he doubted very much if he had due to the time element. I asked if there was any conversation on the road back to town and he said there was none. I asked if the boyfriend had threatened him in any way and he said that he had not, that they just didn’t talk. He merely took the man back to his car and let him out. I asked if Maurice actually saw the knife and he said he had, that the light was good enough.
“I asked if he saw the knife go into Lillie Mae’s body and he stated that he did see this, that it had a long blade. I asked where the knife was at that time and Maurice stated that he had no knowledge of where the knife was. I asked Maurice if he would be willing to give a written statement covering these events and he said he wanted his public defender to come down to witness the statement; that he wanted to talk to him about another case. At this time, I went out and attempted to contact John S. Morgan of 1324 North Winston, Tulsa, Oklahoma, whose name he had given me.
“During the conversation Melton put marks on the diagram, the one that marked the approximate location of the body when it was found. . . .
“I asked Melton where the argument took place and he made marks on the exhibit to show where he last saw Lillie Mae Colbert’s body and he stated there was a depression over the path in some trees and he made these marks. (Pointing to the exhibit.)
“The interview was finished about 5:15 because Maurice wanted to talk to his attorney.”
At the trial appellant objected strenuously to the admission into evidence of this final statement, together with the map or diagram which it produced. This objection was renewed on his motion for a new trial and is his chief ground for urging reversal here. The thrust of his argument is that a complaint had been filed charging *707him with the offense at the time of the interrogation; that he had a public defender as appointed counsel in connection with the Oklahoma charges then pending against him; and that no interrogation could constitutionally take place in the absence of such counsel. His main reliance is on Massiah v. United States, 377 U. S. 201, 12 L. Ed. 2d 246, 84 S. Ct. 1199.
Before exploring this aspect of appellant’s contention we note that, prior to admitting Agent Klingenberg’s testimony into evidence, the court conducted a hearing on its admissibility outside the presence of the jury, as required by State v. Milow, 199 Kan. 576, 433 P. 2d 538, and Jackson v. Denno, 378 U. S. 368, 12 L. Ed. 2d 908, 84 S. Ct. 1774.
After this hearing the testimony was in sharp conflict. Klingenberg testified as to his reiteration of the Miranda warnings:
“Question: . . . What did you advise him?
“Answer: I advised him he has the right to remain silent; anything you say can be used against you in a court of law and you have the right to talk to a lawyer and have him present while you are being questioned and if you cannot afford to hire a lawyer one would be appointed to represent you before any questions, if you wish one. Then I asked him, do you understand each of these rights explained to you, and, having these rights in mind, do you wish to talk to me now.
“Question: And what, if anything, did he say after you asked him these last two questions?
“Answer: He said that he had something he felt he had to—
“Question: Was anything said about his lawyer at this time?
"Answer: No sir.
“I advised him of his constitutional rights each time I talked to him which was on July 20 in Tulsa and on February 27 in Independence, Kansas. Each time he said he understood these rights. On July 24, 1967, Melton appeared to be conscious of what was going on. I did not promise him anything or intimidate him in any way. He was not under the influence of alcohol or drugs.
“I talked with Melton about 20 minutes before he related the statement, plus about 45 minutes to include the diagram and the rest of the time was spent in attempting to locate his attorney who was out of town.
“Question: When was the first time he told you he had an attorney and he wanted to have his attorney there?
“Answer: The first time he mentioned an attorney was after this oral statement. I asked him for a written statement and he said he would like to have his attorney witness this statement.”
According to Klingenberg, the interview commenced about 3:30 p. m., and the discussion of the Lillie Mae Colbert case about 4:00 p. m. By 5:15 it was completed, including the drawing of the con*708troversial diagram with appellant’s marks on it. At that time Klingenberg asked appellant if he would make a written statement, to which appellant agreed, but said he would like to have his Oklahoma public defender present to witness it. This, according to Klingenberg, was the first time appellant had mentioned wanting an attorney and the first time he was aware that appellant had one. The interrogation immediately ceased and an effort was made to locate appellant’s Oklahoma attorney. By 10:30 p. m. it was determined that the attorney was out of town, and the interview ended. The following day Klingenberg again met with appellant, who was accompanied by his Oklahoma attorney. He was advised that appellant wished to make no further statements, and none were taken.
Appellant, on the other hand, testified at the hearing that he had on July 20 agreed with Klingenberg to make a statement in the presence of his attorney, and that during the interview of July 24, he expected his attorney momentarily, pursuant to such agreement. According to him, the interrogation lasted during the entire seven hour period; during that period Klingenberg appeared angry at times, dangled hopes of leniency at other times; and concluded by promising to “throw the book” at him. (Klingenberg specifically denied both intimations of leniency or threats of any kind.) He also denied having made any marks on the diagram prepared by Klingenberg. (Agent Gaunt, on rebuttal at the trial, testified he had observed appellant marking the diagram, but apparently this testimony was not introduced at the pre-admission hearing.)
At the close of the hearing the trial court made the following findings:
“Yes. Well, the Court is going to find that the defendant did make a statement and that he was conscious and was capable of understanding what he said and did, and that he was not induced to make this statement under compulsion or by infliction or threats of infliction of suffering upon him or another, or by prolonged interrogation under such circumstances as to render the statement involuntary or by threats or promises concerning action to be taken by a public official with reference to the crime.
“The Court is also going to find that this statement was voluntarily and understandingly made after having been advised of his rights not only on this occasion but previous to this time that the defendant had been through this procedure; had previously had an attorney appointed for him in another case and was fully aware that he was entitled to the protection of an attorney and that he voluntarily proceeded to make the statement.”
It was incumbent on. the trial court to weigh the conflicting evidence and determine the voluntariness and admissibility of the *709statement. State v. Milow, supra. There being substantial competent evidence to sustain its findings they will not be disturbed on appellate review. Baker v. State, 207 Kan. 214, 483 P. 2d 1039; State v. Harden, 206 Kan. 365, Syl. ¶¶ 2, 4, 480 P. 2d 53; State v. Pittman, 199 Kan. 591, Syl. ¶ 3, 433 P. 2d 550.
Appellant insists, however, that after charges were filed against him no statement could be taken from him in the absence of counsel, under the doctrine of Massiah v. United States, supra. We do not read Massiah so broadly. In that case federal officers surreptitiously monitored through electronic means a post-indictment conversation between the accused and a codefendant who had agreed to cooperate with the investigating officers. Massiah at that time was represented by retained counsel. He was unaware of the fact that he was, in effect, being interrogated by a government agent. Certainly no element of waiver was present. The statement was held inadmissible on Sixth Amendment grounds because of the absence of counsel.
As we see it, this holding must be scrutinized in the light of Miranda v. Arizona, 384 U. S. 436, 16 L. Ed. 2d 694, 86 S. Ct. 1602. That case, while greatly enlarging the concept of the right to counsel during custodial interrogation, clearly recognized that, “The defendant may waive effectuation of these rights, provided the waiver is made voluntarily, knowingly and intelligently.” (384 U. S. at 444.) And further, “Any statement given freely and voluntarily without any compelling influence is, of course, admissible in evidence.” (l. c. 478.) What Miranda was concerned with was the advice and warnings which must be given a suspect before interrogation — in the absence of which constitutional rights cannot be said to have been “voluntarily, knowingly and intelligently” waived.
The trial court made an explicit finding that the statement in question here was voluntarily made after appellant had been fully advised of his rights on several occasions. Implicit in this finding was that appellant had waived the right to have counsel present.
Appellant’s Oklahoma counsel had, of course, been appointed to represent him only with respect to the Oklahoma charges, not those filed in Montgomery County. Hence there is room for the state’s argument that appellant was without counsel as to the Kansas charges and Massiah is wholly inapplicable.
Leaving this argument aside, we are unwilling to depart from our prior holdings and now say, as appellant would have us do, that a *710statement elicited from a defendant in the absence of counsel is inadmissible under any circumstances. See, e. g., Morris v. State, 203 Kan. 249, 452 P. 2d 840; Cox v. State, 199 Kan. 797, 433 P. 2d 470; Powers v. State, 194 Kan. 820, 402 P. 2d 328. We hold that a waiver of counsel may be effectively made after, as well as before, charges are filed. Cf. Holt v. State, 202 Kan. 759, 760-61, 451 P. 2d 221.
The formality of filing a complaint is not the touchstone in determining when the proceedings have reached a “critical” stage when the right to counsel attaches — else we would not have Miranda or its predecessor, Escobedo v. Illinois, 378 U. S. 478, 12 L. Ed. 2d 977, 84 S. Ct. 1758, both asserting a right to counsel at a time prior to the filing of formal charges. The real issue in confession cases is the validity of the waiver of the accused’s Fifth and Sixth Amendment rights, a fact question to be determined in the light of the totality of the circumstances. As pointed out above, this question has been determined in this case in favor of the admissibility of appellant’s statement.
Our view of Massiah is in accord with that of the overwhelming majority of the federal courts to which the problem has been presented. Their view is aptly summarized in United States v. De Loy, 421 F. 2d 900 (5th Cir. 1970) where the court was dealing with an indicted defendant who had counsel, but nevertheless insisted on communicating with agents of the Federal Bureau of Investigation. When these communications were admitted at his trial, the defendant objected on the basis of Massiah. In holding the statements admissible the court first posed the problem:
“Massiah, however, left unanswered a basic question: Are all post-indictment statements made without the presence of counsel inadmissible or are such statements tainted only when there exists some ‘special circumstances’ such as the surreptitious radio surveillance there involved?” (p. 901.)
Noting that the Third Circuit had given the decision a broad reading, outlawing all post-indictment statements given in the absence of counsel, the court went on to say:
“Other circuits, however, have taken a more restrictive view of Massiah, allowing the admission of post-indictment statements voluntarily and deliberately made by a properly warned defendant who was not tricked into speaking by some deliberate act of the investigating officers. Arrington v. Maxwell, 6 Cir. 1969, 409 F. 2d 849; Reinke v. United States, 9 Cir. 1968, 405 F. 2d 228; Coughlan v. United States, 9 Cir. 1968, 391 F. 2d 371, cert. denied, 393 U. S. 870, 89 S. Ct. 159, 21 L. Ed. 2d 139; United States v. Garcia, 2 Cir. *7111967, 377 F. 2d 321, cert. denied, 389 U. S. 991, 88 S. Ct. 489, 19 L. Ed. 2d 484; United States v. Gardner, 7 Cir. 1965, 347 F. 2d 405, cert. denied, 382 U. S. 1015, 86 S. Ct. 626, 15 L. Ed. 2d 529; United States v. Accardi, 2 Cir. 1965, 342 F. 2d 697, cert. denied, 382 U. S. 954, 86 S. Ct. 426, 15 L. Ed. 2d 359.” (p.902.)
See also, United States v. Crisp, 435 F. 2d 354 (7th Cir. 1970).
We believe this to be the sounder rule, and follow it here in holding that it was not error to admit appellant’s statement and the contested exhibit.
Appellant also urges that the evidence was insufficient to sustain his conviction. Granted that, apart from appellant’s own statements which were clearly intended to be exculpatory, the evidence on which he was convicted was largely circumstantial, our function on appeal is to ascertain whether there was a basis in the evidence for a reasonable inference of guilt. State v. Aten, 203 Kan. 920, Syl. ¶ 6; 457 P. 2d 89; State v. Nicolay, 202 Kan. 209, Syl. ¶ 2, 447 P. 2d 403.
Without reviewing all of the state’s evidence, we have no hesitation in saying it was ample to support the verdict. We mention only that the deceased was last seen alive in appellant’s company; from this last viewing at about 5:00 a. m. until he was seen by officer Flowers about 8:00 a. m., his activities were unaccounted for; at that hour he had dirt on his clothes; his bloody shirt was found in close proximity to the site of the body. Additionally, there was testimony that he had previously admitted to Rose Lloyd at least one attempt to molest the deceased sexually at a time when he was “smoking dope,” and while Rose, his paramour of the moment, was in the hospital. To all this must be added his three inconsistent statements as to his last sight of the deceased, including the inherently incredible final one involving the unknown assailant, his disinterested spectator’s role at the homicide, his accommodation of the killer in taking him back to Coffeyville without comment, and his subsequent silence as to these events.
As a corollary of this argument appellant asserts that the circumstances of the crime all point to an intentional killing, and that there is no evidence of malice or ill will on his part towards the deceased. Hence, he argues, the evidence cannot support a conviction of first degree manslaughter. His theory here seems to be murder or nothing.
The answer is twofold. First, the record is barren of any objection to the court’s instructing the jury on the lesser included offense or *712submitting the verdict form to it; and second, the mental state of the attacker is an essential element in determining the culpability of any homicide. The medical testimony was that none of the wounds would have been fatal by itself, and that with prompt medical attention she might have survived. The jury might well infer that her attacker did not intend her death, but that it was the result of an assault upon her — L e., first degree manslaughter. Thus it was wholly proper for the court to instruct the jury on a degree of homicide which takes these elements into account, and the jury might reasonably have reached the verdict it did. See State v. Patterson, 200 Kan. 176, 434 P. 2d 808; State v. Booker, 200 Kan. 166, 434 P. 2d 801.
Finally, we reach appellant’s attack on the three prior convictions which provided the basis for his sentence under the habitual criminal act. Each was had in the district court of Montgomery County; in each appellant entered a plea of guilty while represented by and after extensive consultation with appointed counsel; and in each he claims the plea was induced by an infringement of his constitutional rights at some prior stage of the proceeding. The first was a 1955 conviction for burglary and larceny in which he claims an invalid confession was used at his preliminary hearing. The second was a 1959 conviction for the same offense, and about which he makes the same complaint. The third was a 1964 conviction for the unlawful possession of a pistol under former K. S. A. 21-2611, as to which he contends the pistol in question was seized as a result of an unlawful search and was introduced in evidence at his preliminary hearing.
He makes no contention that any of his guilty pleas were involuntary or coerced by anything beyond the normal pressure exerted by the knowledge he and his attorney had in each case concerning the evidence in the state’s possession. As to the second two, he states in the affidavit submitted in support of his motion for resentencing that each plea was entered as a result of “plea bargaining” between his attorney and the county attorney whereby in each case the prosecutor refrained from invoking the habitual criminal act. This fact alone, of course, does not amount to “coercion” to enter the plea. See Mr. Justice Fromme’s extensive discussion of the entire field of plea negotiations and agreements in State v. Byrd, 203 Kan. 45, 453 P. 2d 22. And see Whaley v. State, 202 Kan. 175, 446 P. 2d 397.
*713We have consistently held that a plea of guilty freely and voluntarily entered after consultation with counsel and with full knowledge of the possible consequences waives any defects or irregularities occurring in any of the prior proceedings. See State v. Kennelly, 207 Kan. 344, 347, 485 P. 2d 179; Lee v. State, 207 Kan. 185, 483 P. 2d 482; Stewart v. State, 206 Kan. 147, 476 P. 2d 652. This is so even though the defects may reach constitutional dimensions. Thus, an otherwise valid guilty plea is not subject to collateral attack because it was entered to secure a lesser penalty, even though the statutory scheme imposing the penalty sought to be avoided may be, or is later declared to be, unconstitutional. Brady v. United States, 397 U. S. 742, 25 L. Ed. 2d 747, 90 S. Ct. 1463; Parker v. North Carolina, 397 U. S. 790, 25 L. Ed. 2d 785, 90 S. Ct. 1458. Neither is a plea vitiated if based on a mistaken view of the admissibility of a confession, even if the confession was in fact coerced. McMann v. Richardson, 397 U. S. 759, 25 L. Ed. 2d 763, 90 S. Ct. 1441; Parker v. North Carolina, supra. By the same reasoning a plea is not involuntary merely because motivated by the state’s possession of evidence which may have been acquired in violation of the accused’s Fourth Amendment rights. We find no merit in appellant’s attacks on his prior convictions and on the sentence which they produced.
The judgment is affirmed.
APPROVED BY THE COURT.