
368 N.W.2d 116 (1985)
Lynn Anne McKEEVER, Appellant,
v.
Stephen GERARD, Magistrate, Appellee.
No. 84-1042.
Supreme Court of Iowa.
May 22, 1985.
*117 Barbara A. Schwartz, Iowa City, Lynn Anne McKeever, pro se, Iowa City, and Mike Boock and Leslie Lee-Dixon, Student Legal Interns, Iowa City, for appellant.
Linda A. McGuire, Asst. Johnson Co. Atty., and Randall Tilton, Student Legal Intern, Iowa City, for appellee.
Considered en banc.
LARSON, Justice.
Lynn McKeever, plaintiff in this certiorari action, was convicted by a jury, before a judicial magistrate of public intoxication in violation of Iowa Code section 123.46 (1983). Her motions for new trial and judgment notwithstanding the verdict were overruled. Upon the request of McKeever, a deferred judgment was then ordered by the magistrate. See Iowa Code § 907.3. McKeever appealed to a district court judge and simultaneously brought the certiorari action against the magistrate, Steven Gerard, claiming "illegality" within the meaning of Iowa Rule of Civil Procedure 306 concerning his trial and post-trial rulings.
The cases were consolidated in the district court. The court, L. Vern Robinson, Judge, ruled (1) the appeal must be dismissed, because in a deferred-judgment case, there is no judgment from which to appeal; and (2) a certiorari action such as this, brought to challenge the same alleged errors, is in reality only a back-door appeal, thus unavailable in a deferred-judgment case. McKeever appealed to this court only the certiorari portion of the ruling; she did not appeal the conviction itself. We affirm.
The charge of intoxication grew out of McKeever's confrontation with Iowa City police officers in connection with their OWI arrest of the driver of a van in which she was a passenger. After a party, and on the way to McKeever's home, the driver was stopped by a police officer who had observed erratic driving. After placing the driver in a patrol car, two of the arresting officers began a conversation with McKeever, during which she stated that she would not drive the van away from the scene because she was "not sober enough to drive." Shortly thereafter, she was arrested for public intoxication.
At McKeever's trial for public intoxication, the court used the definition of "intoxication" found in the Iowa Uniform Instruction for prosecutions under Iowa Code section 321.281 (OWI).[1] (There is no uniform *118 instruction defining "intoxication" for purposes of public intoxication prosecutions under Iowa Code section 123.46.) In instructing the jury on the definition of intoxication, the magistrate rejected McKeever's requested instruction which stated that "intoxication was established when by reason of her use of alcohol, her reason or judgment is impaired or she has lost control of the actions of her body to such a degree that she might endanger herself or other persons or property or annoying members of the public in her vicinity." The jury returned a verdict of guilty.
Combined motions for judgment notwithstanding the verdict and for a new trial, raising the instruction issue, and others not involved on this appeal, were overruled by the magistrate. Sentencing was set for February 27, 1984. On that date, McKeever filed an application for deferred judgment under Iowa Code section 907.3. This application was granted by the court and McKeever was ordered to serve twelve months of nonreporting probation, to provide ten hours of community service, and to pay court costs.
On March 6, 1984, McKeever filed her notice of appeal from the deferred judgment order and on the same date filed a petition for writ of certiorari. Both actions challenged the magistrate's denial of her motion for a new trial. As already noted, the appeal, and the certiorari case, were resolved against the plaintiff in district court.
McKeever asserts the writ of certiorari is available in this case to correct errors that were not reviewable on direct appeal. She concedes that, under our ruling in State v. Anderson, 246 N.W.2d 277, 279 (Iowa 1976), no appeal is available from a deferred judgment. While certiorari is available regardless of the finality of a judgment, it is available only under very limited circumstances. Specifically, a writ of certiorari is granted only where, in the exercise of judicial functions, an officer exceeds the bounds of proper jurisdiction or otherwise acts illegally. Iowa R.Civ.P. 306. See also State v. District Court for Polk County, 231 N.W.2d 1, 5 (Iowa 1975); State v. Cullison, 227 N.W.2d 121, 126 (Iowa 1975). McKeever does not contend that the magistrate acted beyond the scope of his jurisdiction, only that he acted illegally in denying her motion for a new trial.
In Vohs v. District Commissioners, 218 N.W.2d 595, 596 (Iowa 1974), this court defined "illegally," as used in Iowa Rule of Civil Procedure 306:
There is illegality within the meaning of the certiorari rule "when there is not substantial evidence to support the findings on which the inferior court or tribunal based its conclusions of law." ... [Citing authority].
See also Collier v. Denato, 247 N.W.2d 236, 238 (Iowa 1976). Illegality also exists when the tribunal does not apply the proper rule of law. Iowa Freedom of Information Council v. Wifvat, 328 N.W.2d 920, 922 (Iowa 1983); Hightower v. Peterson, 235 N.W.2d 313, 317 (Iowa 1975).
We have recognized our authority to review by certiorari in the following types of circumstances: (1) a motion to suppress evidence; see State v. District Court for Linn County, 218 N.W.2d 641, 643 (Iowa 1974); State v. Holliday, 169 N.W.2d 768, 770-71 (Iowa 1969); (2) an order denying a transfer of proceedings to juvenile court; Mallory v. Paradise, 173 N.W.2d 264 (Iowa 1969); (3) a challenge to a trial court's order challenging the place of a trial; Harnack v. District Court, 179 N.W.2d 356 (Iowa 1970); (4) the alleged improper joinder of offenses and the erroneous denial of discovery in a simple misdemeanor prosecution; Hadjis v. District Court, 275 N.W.2d 763 (Iowa 1979); (5) the alleged erroneous denial of defendant's motion for a change of venue; Pollard v. District Court, 200 N.W.2d 519 (Iowa 1972); (6) the alleged *119 erroneous denial of motion to dismiss in a simple misdemeanor; City of Des Moines v. Elliott, 267 N.W.2d 44 (Iowa 1978); and (7) the alleged erroneous exclusion of the press and public from defendant's pretrial suppression hearing; Iowa Freedom of Information Council v. Wifvat, 328 N.W.2d 920 (Iowa 1983).
These cases show that certiorari review of court action is ordinarily used prior to final disposition. The rationale is explained in Steinbeck v. Iowa District Court, 224 N.W.2d 469, 472 (Iowa 1974):
[t]his court has consistently enlarged the scope of certiorari as a remedial procedure to avoid unnecessary and costly litigation, particularly where the lower court's jurisdiction or the legality of its acts is challenged on exclusively law or constitutional issues.
(Citations omitted.)
No cases have been found allowing certiorari review at the conclusion of the case and raising alleged errors of law ordinarily raised through an appeal. We agree with the plaintiff that the availability of other remedies would not foreclose the use of certiorari. On the other hand, the remedial functions of certiorari, including the avoidance of unnecessary litigation and the provision of a method of review when no other means are available, would not be advanced by recognizing that remedy here. The issuance of the writ could not avoid litigation; the trial was already completed. It is, as the district court observed, in reality an appeal under a different label. The petition came after the sentencing hearing and raised alleged errors in the trial itself. Nor is its recognition necessary to grant redress to a party who otherwise would have none; the remedy of a direct appeal was not unavailable to McKeever; she simply elected to waive it by her application for deferred judgment.
There are obvious benefits in being granted a deferred judgment. In opting for it, however, a defendant relinquishes certain other rights, including the right of appeal. This is, no doubt, one reason for the statutory requirement that the defendant consent to entry of a deferred judgment. See Iowa Code § 907.3. As we said in Anderson,
[s]imilar hard choices are not uncommon in the criminal law field. A defendant who pleads guilty relinquishes several basic constitutional rights. Boykin v. Alabama, 395 U.S. 238, 243, 89 S.Ct. 1709, 1712, 23 L.Ed.2d 274, 279-280 (1969). A defendant who elects to submit evidence after trial court overrules his motion for directed verdict at close of State's evidence risks supplying essential parts of the State's case. Cline v. United States, 395 F.2d 138, 144 (8th Cir. 1968); State v. Ahern, 227 N.W.2d 164, 168 (Iowa 1975).
Here the combined language of § 793.2 and § 789A.1 required defendant to elect between an order deferring judgment and a right to immediate appeal. He chose the first alternative.
246 N.W.2d at 279.
We believe the right to raise, after a trial, alleged trial court errors through a certiorari action is one of those rights, like an appeal, which is waived by an election for a deferred judgment. A defendant who elects to have the case eventually treated as if there were no conviction cannot simultaneously attack the case as if there had been one. Under these circumstances, we will not recognize the certiorari procedure.
In view of this disposition, it is unnecessary to address McKeever's complaints about the substantive trial court rulings.
AFFIRMED.
All Justices concur except CARTER, McCORMICK, and WOLLE, JJ., who dissent.
CARTER, Justice (dissenting).
I dissent. If the district court had exercised its discretion to refuse to issue a writ of certiorari to review the acts of the judicial magistrate in the present case, this would have been fully justified. I believe, however, that the district court was wrong *120 in deciding the case on the ground that it had no discretion to issue a writ of certiorari because a deferred judgment had been granted.
In upholding the district court's determination that deferred judgments may never be reviewed by certiorari, the majority opinion proceeds on two theories: (1) that this would be an inappropriate use of the writ of certiorari, and (2) that plaintiff has waived any right to review the magistrate's finding of guilt by consenting to a deferred judgment. I submit that neither of these theories is tenable.
With respect to the general authority of the district court to review acts of a judicial magistrate by means of a writ of certiorari, Iowa Rule of Civil Procedure 309 contemplates that the district court, acting through a district judge, may issue writs of certiorari, where appropriate, for this purpose. As the majority concedes, one of the primary criteria for issuance of a writ of certiorari is that no other means of review is available. Plaintiff's case meets this test completely. It is uncontroverted in the present case that appeal is not available to review the magistrate's determination that plaintiff is guilty of the offense charged. See State v. Anderson, 246 N.W.2d 277, 278-79 (Iowa 1976). Indeed, it seems axiomatic that, if appeal were available, there would be no need to seek a writ of certiorari.
The majority argues that notwithstanding the absence of another remedy certiorari is inappropriate because (a) in the present case it will not serve to avoid unnecessary litigation and (b) the writ is sought at the conclusion of the proceeding rather than at some intermediate step in the judicial process. Neither of these circumstances constitutes a valid ground under our case law for holding that certiorari is unavailable to plaintiff. The element of avoiding unnecessary litigation relates to a limited category of cases. It concerns those cases in which the choice facing the court is whether to grant a discretionary review at intermediate stage in the proceedings or to require the party seeking review to await the outcome of the proceedings at which time review may be had as of right upon final judgment. It is analogous to the standard often applied in granting interlocutory appeals requiring a showing that immediate appellate resolution of the issue will materially advance the progress of the litigation. See Banco Mortgage Co. v. Steil, 351 N.W.2d 784, 787 (Iowa 1984). This standard has no applicability to the present case because plaintiff's review must be now or not at all.
There is no support in our case law for the majority's suggestion that certiorari review is inappropriate because it is sought at the conclusion of the litigation rather than at some intermediate stage. Certiorari review is routinely available to review convictions and punishment for contempt at the conclusion of the litigation and to review orders of the district court on attorney fee applications made at the conclusion of both the primary litigation and the hearing on entitlement to compensation.
Equally untenable is the majority's contention that, by affirmatively consenting to the entry of a deferred judgment, the plaintiff has waived any right to seek judicial review of the underlying finding of guilt. That conclusion is based in part on a misinterpretation of the rationale underlying our decision in Anderson, 246 N.W.2d at 278-79. That case held that there was no right of appeal from a deferred judgment. This holding was posited squarely on the ground that the absence of a sentence constituting a final judgment precludes a right of appeal under the statutes which create our appellate jurisdiction. After concluding that a right of appeal was not available under the applicable statutes, the court in Anderson did observe that, because a deferred judgment cannot be entered without a defendant's consent, the defendant may, in some cases, face a hard choice. Waiver was not a ground for the decision, however, and it in no way passed upon the *121 propriety of certiorari as a means of review.[1]
I submit that there is no established principle which supports the court's waiver theory and there is a strong principle which refutes it. Sentencing in criminal cases is entrusted to the sound discretion of the sentencing judge. The sentencing judge has a duty to render that sentence which the judge determines to be the most appropriate under the available sentencing options. A defendant in a criminal case has a vital interest in obtaining the best result available under the law and the evidence with respect to both the issue of guilt and the appropriate sentence. Where the sentencing judge has determined that deferred judgment is the most appropriate choice, it does not advance the cause of justice that a defendant must accept less than the most appropriate sentencing option in order to seek appellate relief with respect to prejudicial error which may have produced an unlawful determination of guilt.
We have recognized that the scope of the writ of certiorari under our rules of civil procedure and appellate procedure represents an enlargement of the common law writ in order to provide a means of review "when, without it, substantial justice could not be had." Hohl v. Board of Education, 250 Iowa 502, 508-09, 94 N.W.2d 787, 791 (1959). See also Note, Scope of Common Law Certiorari and Some Statutory Changes, 19 Iowa L.Rev. 137, 144 (1933). To deny the availability of such a discretionary review in all deferred judgment cases is to unnecessarily paint ourselves into a corner from which it may become impossible to correct a substantial injustice.
The potential for this occurring in cases where deferred judgments are granted has been greatly increased by legislative changes increasing the collateral consequences of this type of sentencing disposition in certain cases. See, e.g., Iowa Code §§ 321.281(2)(c), (6) (1985) (for purposes of determining guilt of second or third offense, deferred judgments are to be counted; grant of deferred judgment requires mandatory license revocation). I would hold that in a proper case the discretionary writ of certiorari is available as a means for review of judicial action which terminates in the granting of a deferred judgment.
McCORMICK and WOLLE, JJ., join this dissent.
NOTES
[1]  No. 3103 OMVUIBEING UNDER THE INFLUENCEDEFINITION

The law provides that a person is under the influence of an (alcoholic beverage) whenever, by reason of the use of such substance, including beer, his reason [or] faculties have become affected, or his judgment impaired, or his passions are visibly excited, or whenever the use thereof has caused him to lose control in any manner, or to any extent, of the actions or motions of his person or body.
[1]  The Anderson decision does imply that certiorari may have been available in that case to review certain aspects of the litigation, notwithstanding the grant of a deferred judgment. Id. at 279.
