
135 Cal.App.3d 205 (1982)
185 Cal. Rptr. 182
DONALD LEE HARTMAN, Petitioner,
v.
THE SUPERIOR COURT OF KERN COUNTY, Respondent; THE PEOPLE, Real Party in Interest.
Docket No. 7052.
Court of Appeals of California, Fifth District.
August 18, 1982.
*206 COUNSEL
Willard L. Weddell, Public Defender, and Nadine Burns, Deputy Public Defender, for Petitioner.
No appearance for Respondent.
George Deukmejian, Attorney General, Robert H. Philibosian, Chief Assistant Attorney General, Arnold O. Overoye, Assistant Attorney General, James T. McNally and Susan Rankin Bunting, Deputy Attorneys General, for Real Party in Interest.
OPINION
THE COURT.[*]
Petitioner seeks a writ of mandate directing respondent court to grant his motion to set aside a criminal information pending against him.

FACTS
Petitioner stands accused by information of felonious burglary in violation of Penal Code section 459.
The preliminary hearing evidence shows that between 8:30 and 9 a.m. on a Thursday petitioner broke into an unoccupied mobilehome, which was used mainly on weekends, and took something, probably a small amount of food.
*207 After the evidence had been adduced, petitioner moved the magistrate to reduce the felony burglary charge to a misdemeanor pursuant to Penal Code section 17. His attorney argued that the facts of the crime and petitioner's prior criminal record justified such a reduction.[1]
After the prosecutor argued against the motion, the following dialogue occurred:
"THE COURT: Mr. Staley [Defense Counsel], if the court made it a misdemeanor under Section 17, is the defendant going to plead guilty?
"MR. STALEY: Not at this time, your Honor. I would point out October 1st was a Thursday. It was in approximately in the middle of the week, Thursday morning. Court's already heard the testimony concerning the residential use.
"THE COURT: All right. Any other defense or motions?
"MR. STALEY: No, your Honor.
"THE COURT: All right. I will deny the motion to make it a Section 17."
Petitioner was held to answer for felony burglary.
Petitioner moved respondent court to set aside the information upon the ground, inter alia, that he was illegally committed because the magistrate inquired whether he would plead guilty to a misdemeanor. The motion was denied.

DISCUSSION
(1) Review by writ of mandate is proper. (See People v. Pompa-Ortiz (1980) 27 Cal.3d 519, 529 [165 Cal. Rptr. 851, 612 P.2d 941].)
(2) In Jackson v. Superior Court (1980) 110 Cal. App.3d 174 [167 Cal. Rptr. 749] the magistrate expressly stated that he would grant the defendant's motion to reduce a felony charge to a misdemeanor if the *208 defendant would plead guilty to the reduced charge, but otherwise would deny the motion. The reviewing court held that a magistrate may not condition the exercise of his judicial discretion to reduce the offense to a misdemeanor upon the entry of a plea of guilty by the defendant. In doing so, the court relied upon In re Lewallen (1979) 23 Cal.3d 274 [152 Cal. Rptr. 528, 590 P.2d 383, 100 A.L.R.3d 823], and Esteybar v. Municipal Court (1971) 5 Cal.3d 119 [95 Cal. Rptr. 524, 485 P.2d 1140].
Lewallen holds that the fact of conviction upon a plea of not guilty is "completely irrelevant at sentencing; if a judge bases a sentence, or any aspect thereof, on the fact that such a plea is entered, error has been committed and the sentence cannot stand." (23 Cal.3d at p. 279.)
Esteybar v. Municipal Court, supra, 5 Cal.3d 119, 125 states, "In determining whether a defendant should be held to answer on a felony or a misdemeanor, a committing magistrate exercises a judicial power which must be based upon an examination of the circumstances of the particular case before him."
In this case, the magistrate did not expressly condition the exercise of his discretion upon petitioner's willingness to plead guilty to a misdemeanor; however, the magistrate inferably considered petitioner's willingness to plead guilty in exercising his discretion to reduce the charge.[2]
The circumstances of the case within the meaning of Esteybar do not include petitioner's intent to exercise his constitutional right to stand trial upon the misdemeanor if Penal Code section 17 relief is granted. Such an intent is as irrelevant to the charge reduction issue before the magistrate in this case as a not guilty plea to sentencing after conviction. (See In re Lewallen, supra, 23 Cal.3d 274, 279.)
Furthermore, the magistrate's inquiry as to petitioner's intent to plead guilty gives rise to one or more of the following appearances of impropriety: (1) judicial discretion was being exercised to encourage and/or coerce a guilty plea; (2) petitioner was penalized by an adverse ruling upon his motion to reduce the charge for exercising his constitutional *209 right to thereafter stand trial; and (3) the municipal court's future trial calendar was a factor in the exercise of judicial discretion.
Therefore, we hold that the magistrate's inquiry regarding petitioner's intent to plead guilty was error.
Respondent court erred in denying petitioner's motion to set aside the information. (Jackson v. Superior Court, supra, 110 Cal. App.3d 174, 177-178.)
Let a peremptory writ of mandate issue directing the Kern County Superior Court to vacate its order denying the defendant's motion to set aside information No. 22885 and to enter a new order granting said motion.
The stay order issued by this court on April 23, 1982, shall remain in effect until all acts herein directed have been performed, this decision is final in all courts, or the Supreme Court grants a hearing herein, whichever may first occur.
NOTES
[*]   Before Zenovich, Acting P.J., Hanson (P.D.), J., and Martin, J.[]

[] Assigned by the Chairperson of the Judicial Council.
[1]  Defense counsel stated, "Ask the court to look at the court's record, which ought to be attached somewhere in the court's file. Because it is my understanding, either no record or minimal record at all for some type of driving under the influence a number of years ago. No theft related offense."
[2]  The magistrate presumably would not elicit information about a guilty plea unless he considered it relevant to the motion before him for decision. The question was asked immediately prior to the ruling on the motion.
