
194 N.W.2d 179 (1972)
187 Neb. 792
STATE of Nebraska, Appellee,
v.
Robert L. REED, Appellant.
No. 38173.
Supreme Court of Nebraska.
February 4, 1972.
*180 Frank B. Morrison, Public Defender, Bennett Hornstein, Asst. Public Defender, Omaha, for appellant.
Clarence A. H. Meyer, Atty. Gen., Bernard L. Packett, Asst. Atty. Gen., Lincoln, for appellee.
Heard before WHITE, C.J., and SPENCER, BOSLAUGH, SMITH, McCOWN, NEWTON, and CLINTON, JJ.
BOSLAUGH, Justice.
The defendant appeals from a conviction for burglary upon a plea of guilty. He contends that the conviction should be reversed because his plea was coerced by the filing of a habitual criminal charge; the trial court failed to advise him of certain constitutional rights; and the trial court failed to ascertain that there was a factual basis for the plea.
At the arraignment on July 13, 1970, the defendant appeared with the public defender and pleaded not guilty. On January 22, 1971, 3 days before the case was set for trial, an amended information was filed which charged the defendant with being a habitual criminal. On January 25, 1971, the defendant appeared with private counsel, withdrew his plea of not guilty, and entered a plea of guilty to the burglary charge.
The plea was the result of a plea bargain. In return for the defendant's plea of guilty to the burglary charge, the county attorney agreed to dismiss the habitual criminal charge, dismiss a separate burglary charge (referred to as Doc. 81, No. 435), and recommend a sentence of imprisonment for not to exceed 7 years. The terms of the plea bargain were disclosed in open court and the bargain was fully performed.
The defendant claims that his plea was involuntary because it was made to avoid the chance of a long sentence on the habitual criminal charge. This case is similar to North Carolina v. Alford, 400 U.S. 25, 91 S.Ct. 160, 27 L.Ed.2d 162, in which the defendant claimed that he was innocent but pleaded guilty to second degree murder in order to avoid the possibility of a death sentence. The United States Supreme Court held that such a plea was valid. See, also, Ford v. United States, 418 F.2d 855 (8th Cir., 1969), 295 F.Supp. 1180; Meyer v. United States, 424 F.2d 1181 (8th Cir., 1969); Hulett v. Sigler, 242 F.Supp. 705 (D.C.Neb., 1965).
Here the defendant was represented by counsel and the alternatives were discussed at length. The defendant's plea was the "product of a free and rational choice." North Carolina v. Alford, supra.
The fact that the habitual criminal charge was added by amendment just before the case was set for trial does not afford the defendant any basis for relief. It is within the discretion of the county attorney to decide whether such a charge should be filed, and the time of filing is of no consequence.
The plea was not involuntary even though induced by the filing of the habitual criminal charge. A threat or promise of illegal action may invalidate a plea, but a threat to prosecute when the facts warrant prosecution should not be considered coercive. Ford v. United States, supra.
The defendant did not admit that he was guilty of burglary, but did admit that he was found inside the building. Upon inquiry by the trial court, the county attorney stated that he believed he would be able to obtain a conviction for burglary. The defendant's theory seemed to be that he would not be convicted upon trial because there was no evidence of a forced entry and nothing had been removed from the building at the time he was apprehended. These facts did not constitute a defense to burglary. Although it is the better practice to make a more complete inquiry into the factual basis for the plea, the record *181 here is adequate to show that the trial court determined there was a factual basis for the plea.
The defendant complains that the trial court did not advise him specifically as to his privilege against self-incrimination, his right to trial by jury, his right to confront his accusers, and then obtain a waiver of each of these rights. The trial court did advise the defendant at length concerning his right to a jury trial or to a trial by the court; that no one could force him to plead guilty; and that no plea would be accepted which was not voluntary. The criteria is whether the defendant understood the relevant factors involved in a guilty plea. State v. Turner, 186 Neb. 424, 183 N.W.2d 763. The record here shows that the defendant's plea was voluntarily and understandingly entered.
The judgment of the district court is affirmed.
Affirmed.
