
280 N.W.2d 411 (1979)
Jimmie Joe FARLEY, Plaintiff,
v.
The Honorable Luther T. GLANTON, Jr., Defendant.
No. 62076.
Supreme Court of Iowa.
June 27, 1979.
*412 Martha Shepard and John C. Wellman, Des Moines, Polk County-Des Moines Offender Advocate Office, for plaintiff.
J. R. McManus, Des Moines, for defendant.
Considered by REYNOLDSON, C. J., and LeGRAND, REES, HARRIS and ALLBEE, JJ.
ALLBEE, Justice.
Jimmie Joe Farley brings this action in certiorari to challenge the refusal of the district court to accept Farley's plea of *413 guilty. Farley was charged with delivery of a controlled substance, marijuana, in violation of section 204.401(1), The Code 1977. The prosecutor and Farley reached an agreement whereby Farley would plead guilty to delivery of a controlled substance with the stipulation that the delivery was an accommodation. Conviction on the stipulated accommodation charge exposed Farley to a possible jail sentence of six months and a possible fine of $1000. Sections 204.410, 204.401(3), The Code. The possible liability for accommodation is to be contrasted with the mandatory prison sentence of not to exceed five years to be imposed upon conviction of delivery for the purpose of profit. Sections 204.401(1)(b), 789A.1, The Code.
During the plea colloquy, trial court asked Farley to tell what he had done to commit the crime charged. Farley recounted being approached by an individual who turned out to be an undercover agent and who asked to purchase marijuana. Farley said he helped the individual by getting some marijuana for him, but denied making any profit on the transaction. The following exchange occurred:
THE COURT: Do you understand now you could have for a defense, entrapment? If this officer caused you to do something that you wouldn't have done ordinarily, we call that entrapment; and you can use that as a defense.
MR. FARLEY: Well, sir, I talked to [Farley's attorney] and he recommended that I do this. I don't know much about the law.
THE COURT: Do you think that you were entrapped, that you would not have sold this if the officer had not egged you on?
MR. FARLEY: I would not have done it.
THE COURT: Beg your pardon?
MR. FARLEY: I would not have done it if the officer didn't ask me to get him one.
THE COURT: You better talk to your client. If you were entrapped into doing thisIf he had no intent of ever doing this and the officer entrapped you on doing it, that's a perfect defense. I'm going to ask you one time. I'm not going to go through this again. If you think you were entrapped, I'm not going to accept your plea and let you stand trial. ([Farley's attorney] conversed with Mr. Farley off the record.)
MR. FARLEY: Sir, I don't wish to enter a plea of entrapment.
THE COURT: But I'm still saying do you feel, though, that you had no intent to violate the law until this officer came to you and got you to sell this marijuana?
MR. FARLEY: Yes, sir.
THE COURT: Beg your pardon?
MR. FARLEY: No, sir, I was not going to break the law.
THE COURT: I will not accept your plea. You have to stand trial.

(The record was closed.)
On the afternoon of the same day, Farley, with the consent of the prosecutor, reopened the record and attempted once again to enter a plea of guilty to the offense of delivery of a controlled substance with a stipulation that it was an accommodation. It was established that Farley was entering his plea knowingly, voluntarily and intelligently, with full awareness of the options available to him. Once again, however, Farley asserted that he would not have delivered the marijuana to the undercover agent if that agent had not persuaded him to do so. He also denied any intent to break the law. Trial court again refused to accept the plea.
When Farley's counsel argued that the taking of a plea of guilty from a defendant who denied guilt was proper under North Carolina v. Alford, 400 U.S. 25, 91 S.Ct. 160, 27 L.Ed.2d 162 (1970), and State v. Quinn, 197 N.W.2d 624 (Iowa 1971) (per curiam), the court responded: "I'll never take an Alford plea as long as I'm on the bench." Despite this declaration, however, trial court clearly refused the plea in this case solely on the basis that the court feared Farley had an entrapment defense available. No person other than Farley testified *414 during either session of the plea taking, and there was no mention of trial court's having been directed to any other source which established a factual basis for the charge.
The question presented here is different from that considered in State v. Le Matty 263 N.W.2d 559, 561-62 (Iowa Ct.App. 1977) (per curiam). In Le Matty the trial court refused to accept a plea bargain in which the defendant, who had been charged with murder, would plead guilty to manslaughter and larceny of property of a value of more than $20, with no sentence recommendation by the State. The court of appeals held that such a refusal was within the trial court's discretion. Farley's case is different because trial court expressed no reluctance to accept the plea bargain. It was the plea itself which trial court declined to accept.[1] There has been one prior attempt to have this court consider whether a criminal defendant was improperly denied an opportunity to plead guilty. In State v. Heisdorffer, 217 N.W.2d 627 (Iowa 1974), this court declined to consider the question because it was not raised by the facts of the case. Thus, the question is one of first impression in this state.
Because this certiorari action is not one which is specifically authorized by statute, our review is limited to questions of whether trial court acted illegally or without jurisdiction. Hadjis v. Iowa District Court, 275 N.W.2d 763, 765 (Iowa 1979); Iowa R.Civ.P. 306. Review of trial court discretion by certiorari is very limited, being merely to determine whether there has been an abuse thereof. Parrish v. Denato, 262 N.W.2d 281, 284 (Iowa 1978).
Farley attempted, at the trial court level, and attempts here, to demonstrate that North Carolina v. Alford establishes a right of a criminal defendant to have a plea of guilty accepted. This argument is untenable, however, because Alford itself recognized that there is no such constitutional right. 400 U.S. at 38 n.11, 91 S.Ct. at 167, 27 L.Ed.2d at 172. The Alford opinion instead recognized that insofar as the Federal Constitution is concerned, acceptance of pleas is discretionary with the court, and that a state might establish such a right by statute or might "bar [its] courts from accepting guilty pleas from any defendants who assert their innocence." Id. The Constitutional discretion of trial courts in accepting or rejecting pleas was again recognized in Santobello v. New York, 404 U.S. 257, 262, 92 S.Ct. 495, 498, 30 L.Ed.2d 427, 433 (1971).
The inquiry thus must turn to state law, to determine whether that law imposes any particular duty on trial courts or instead reposes a discretion in them. The relevant provision is the initial language of Iowa R.Crim.P. 8(2)(b): "The court may refuse to accept a plea of guilty, . . . ."
Prior to its amendment in 1974, Fed.R. Crim.P. 11 contained language nearly identical to that just quoted. Thus, cases construing the similar language of that rule are of assistance in interpreting our own rule. Young v. City of Des Moines, 262 N.W.2d 612, 619 (Iowa 1978).
The Supreme Court twice cited the pre-1974 version of federal rule 11 to support its conclusion that there is no absolute right to have a guilty plea accepted. See Santobello v. New York, 404 U.S. at 262, 92 S.Ct. at 498, 30 L.Ed.2d at 433; Alford, 400 U.S. at 38 n.11, 91 S.Ct. at 168, 27 L.Ed.2d at 172. And federal courts of appeals which considered the question were uniform in finding that the rule gave trial courts discretion in accepting pleas. See, e. g., United States v. Bettelyoun, 503 F.2d 1333, 1336 (8th Cir. 1974); United States v. Martinez, 486 F.2d 15, 20 (5th Cir. 1973); United States v. Gaskins, 158 U.S.App.D.C. 267, 269, 485 F.2d 1046, 1048 (1973); United States v. Melendrez-Salas, 466 F.2d 861, 862 (9th Cir. 1972) (per curiam); United States v. Bednarski, 445 F.2d 364, 366 (1st Cir. 1971). The scope of that discretion was a matter of some disagreement, however. Compare, e. *415 g., McCoy v. United States, 124 U.S.App. D.C. 177, 178-79, 363 F.2d 306, 307-08 (1966) ("the plea should not be refused without good reason") with Bednarski, 445 F.2d at 366 (trial courts "must seriously consider accepting a tendered plea;" but "the defendant's burden to show an abuse of discretion in refusal should be heavier than [that imposed in, e. g., McCoy]"). See also Gaskins, 158 U.S.App.D.C. at 269, 485 F.2d at 1048 (holding that "it is an abuse of discretion to refuse a guilty plea solely because the defendant does not admit the alleged facts of the crime").
There is also a substantial body of authority in the state courts for reviewing a refusal to accept a guilty plea on an abuse of discretion standard. See, e.g., State v. Fernald, 248 A.2d 754, 760 (Me. 1968); Stevenson v. State, 37 Md.App. 635, 636, 378 A.2d 209, 210 (1977) (guilty plea is opportunity, not right); State v. Goulette, 258 N.W.2d 758, 762 (Minn. 1977) (dicta); State v. Meaney, 563 S.W.2d 117, 118, (Mo.Ct.App. 1978) (implied); State v. Hicks, 89 N.M. 568, 573, 555 P.2d 689, 694 (1976); People v. Portanova, 56 A.D.2d 265, 275, 392 N.Y.S.2d 123, 131 (1977); State v. Reuschel, 131 Vt. 554, 562, 312 A.2d 739, 743-44 (1973) ("should not be refused without good reason"). See also Punch v. United States, 377 A.2d 1353, 1358-59 (D.C.App. 1977) (finding abuse under McCoy standard). But see State ex rel. Headrick v. Couch, 539 P.2d 748 (Okl.Cr.App. 1975).
In sum, these authorities lead us to hold that under Iowa R.Crim.P. 8(2)(b) trial courts have discretion to refuse to accept guilty pleas. We are further persuaded that this discretion is extremely broad.
Trial court refused to accept the plea, as noted earlier, because Farley asserted that he would not have delivered the marijuana but for the persuasion of the undercover agent.[2] This, in trial court's opinion, raised the possibility of an entrapment defense.
Of course, trial court was not required to inquire into the existence of possible defenses, but would have been justified in assuming, unless alerted to the contrary, that counsel had sufficiently advised Farley on those points. State v. Heinen, 252 N.W.2d 454, 455 (Iowa 1977). And some difficulty arises because the portion of the colloquy set out above suggests that trial court was attempting to apply the subjective test for entrapment, rather than the objective test which this court adopted in State v. Mullen, 216 N.W.2d 375, 382 (Iowa 1974). That is, trial court's concern seems to have been focused on the way in which Farley was affected by the undercover agent's approach, rather than the effect which the agent's conduct would have had on a normally law-abiding person. When a trial court bases the exercise of its discretion upon an error of law, that conduct may amount to an abuse of discretion. First Wisconsin National Bank v. KSW Investments, Inc., 71 Wis.2d 359, 364, 238 N.W.2d 123, 126 (1976).
We nonetheless hold that Farley has not met his heavy burden to show abuse and prejudice. See State v. Gartin, 271 N.W.2d 902, 910-11 (Iowa 1978). Even though trial court gave the appearance of applying an incorrect standard regarding entrapment, the court's concern that such a defense might exist, or that Farley might be able to make a sufficient showing to generate a fact question on the issue and put the burden on the State to disprove such a defense, see State v. Cooper, 248 N.W.2d 908, 910 (Iowa 1976), was not entirely unjustified.
Trial court's doubts on this issue went to the sufficiency of the factual basis for the plea. The court's question was whether, if Farley generated a fact question on the entrapment issue, the State could meet its burden.
*416 The Supreme Court in Alford was quite explicit in requiring that a factual basis for a guilty plea be established, particularly where the accused denied his guilt. See 400 U.S. at 38 n.10, 91 S.Ct. at 167, 27 L.Ed.2d at 171. And Iowa R.Crim.P. 8(2)(b) imposes upon trial judges the duty to determine that all pleas of guilty have a factual basis. This factual basis must be "precise enough and sufficiently specific to show that the accused's conduct on the occasion involved was within the ambit of that defined as criminal." United States v. Johnson, 546 F.2d 1225, 1226 (5th Cir. 1977). See also State v. Hansen, 221 N.W.2d 274, 276 (Iowa 1974) (testimony of witnesses attached to indictment may be considered); Ryan v. Iowa State Penitentiary, 218 N.W.2d 616, 619 (Iowa 1974) (factual basis may be established by inquiring of accused, inquiring of prosecutor, or examining presentence report); State v. Quinn, 197 N.W.2d at 625 (minutes of evidence attached to county attorney's information may be considered); Goulette, 258 N.W.2d at 761 (suggesting other methods for showing factual basis in guilty pleas in Minnesota, including introduction of helpful items in prosecutor's file or production of prosecution witnesses for summary of their testimony).
In an Alford plea, because the accused is denying his guilt, a factual basis must be established independent of his statements. Cf. United States ex rel. Dunn v. Casscles, 494 F.2d 397, 400 (2d Cir. 1974) (lack of factual basis other than the defendant's own "mouthing" of the word "guilty" was insufficient). This factual basis is a substitute for the admission of guilt. Harlow v. Murray, 443 F.Supp. 1327, 1330 n.8 (W.D.Va. 1978). See also Goulette, 258 N.W.2d at 761 (factual basis is a means by which the trial court can determine whether an Alford plea is being intelligently entered). In the words of the Alford court, an adequate factual basis is the means of resolving "the conflict between the waiver of trial and the claim of innocence." 400 U.S. at 38 n.10, 91 S.Ct. at 168, 27 L.Ed.2d at 171. Each of the decisions of this court which has considered the propriety of an Alford plea has noted that an adequate factual basis existed.[3]
The precise difficulty which arose here is that after Farley's account raised the issue of entrapment there was no factual basis presented to demonstrate the State's ability to disprove that defense. Yet, at trial, the State would bear that burden. Cooper, 248 N.W.2d at 910. Without such a showing, trial court could entertain doubts about whether Farley's conduct was shown to be "within the ambit of that defined as criminal."
While the ability of the court to entertain such a doubt demonstrates that its discretion was not abused and requires that the writ be annulled, it should be clearly understood that this action does not prevent another attempt by Farley to enter a negotiated plea of guilty accompanied by a showing of an adequate factual basis.
Writ annulled.
NOTES
[1]  It is in this regard that a number of the cases relied upon in this court by the certiorari defendant-trial court, including, for example, United States v. Bean, 564 F.2d 700 (5th Cir. 1977), are distinguishable.
[2]  While we regard the trial court's statement that he would never take an Alford plea as gratuitous under the circumstances, we note that such a flat refusal could amount to a refusal to exercise discretion, which is reversible error. State v. Boston, 233 Iowa 1249, 1256-59, 11 N.W.2d 407, 411-12 (1943); Fagg, A Judge's View of Trial Practice, 28 Drake L.Rev. 1, 5-6 (1978-79). See also State v. Hildebrand, 280 N.W.2d 393 (Iowa 1979); United States v. Gaskins, 158 U.S.App.D.C. at 269, 485 F.2d at 1048.
[3]  See, e.g., State v. Reed, 252 N.W.2d 455, 456-57 (Iowa 1977); State v. Buhr, 243 N.W.2d 546, 550-51 (Iowa 1976); State v. Townsend, 238 N.W.2d 351, 355 (Iowa 1976); State v. Hansen, 221 N.W.2d 274, 276 (Iowa 1974); Young v. Brewer, 190 N.W.2d 434, 438 (Iowa 1971).
