Herbert Tatkenhorst, hereinafter referred to as defendant, was originally informed against in two separate informations, each for the crime of murder in the first degree. On August 29, 1966, defendant entered a plea of not guilty to each charge. The case was set for trial on December 6, 1966. On November 28, 1966, the county attorney filed an amended information charging defendant in two counts with voluntary manslaughter. On the same date defendant entered his pleas of guilty to each count. The court set the date for sentencing for December 12th.
On December 12th defendant filed his motion for a change of judge on the grounds of bias and prejudice, accompanied by affidavit of counsel in accordance with Rule 197, Rules of Crim.Proc., 17 A.R.S. .The judge then stated that had the affidavit been filed before the pleas he would have “been very glad to assign it to another judge,” and indicated it had not been timely filed, but that he wanted to check as to whether defendant had the right to file at that time; if so, he would be glad to step aside.
The attorney for defendant stated he would like “a couple of days to look into the matter, as far as the right to file at this time,” and he also requested a hearing in mitigation of sentence at a future date. The court on the same day denied the petition for change of judge, with the following order:
“This matter having been taken under advisement, and after due consideration:
“IT IS HEREBY ORDERED that the Defendant having failed to file a timely affidavit of Bias and Prejudice, and having failed to offer evidence of actual prejudice, the motion for change of judge is denied, and the sentencing is set for December 20, 1966, at 9:30 A.M.
“Dated: December 12, 1966.
“/s/ ROBERT E. McGHEE Judge of the Superior Court”
On the 13th day of December defendant filed a petition for hearing in mitigation of sentence under Rule 336, Rules of Crim. Proc., 17 A.R.S., which was set for hearing December 20, 1966. On the 20th of December 1966, the court held the hearing in accordance with the petition. At this hearing eleven witnesses testified. The transcript of the hearing comprises 119 pages. At the conclusion thereof, the court sentenced defendant to serve not less than eight nor more than nine years on each of the counts, with sentences to run consecutively. From the order denying the motion for change of judge, and the sentencing of the court, defendant appeals.
The only question to be determined by this Court is whether the affidavit of bias and prejudice which was filed pursuant to Rule 197, Rules of Crim.Proc., 17 A.R.S., was timely, and thereby deprived the court of jurisdiction to perform any judicial act other than order the matter transferred to another judge.
Rule 199, Rules of Crim.Proc., 17 A.R.S., provides:
“The application for change of judge shall be made at least three days before *158the date the action is called for trial, unless the disqualifications were not known' before the three day period, in which event such fact shall be set forth in the affidavit of disqualification.”
Since the affidavit for change of judge was not filed three days before the date set for sentencing, does this rule make it untimely ? This rule is to prevent defendants from waiting until the morning of a trial to file an affidavit for a change of judge and thereby postpone a trial. By its language its application is limited to cases where there is to be a trial on the facts. In the instant case it was not applicable, pleas of guilty having been entered there was to be no trial on the facts. The court made its ruling on the ground that it was untimely for the reason that it had not been filed before the pleas. The court, before making the order of denial of the motion, stated:
“The plea has been entered before me. Before the taking of the plea, I would have been very glad to assign it to another judge, I am just wondering if it is proper for me to do it at this point after the plea has been taken before me, * * * ”
It is the contention of the State in its brief that the affidavit of bias and prejudice was not timely because it was not filed before the pleas were entered. The question then presented is solely whether an affidavit of bias and prejudice is timely when filed after a plea of guilty and before judgment and hearing on mitigation of sentence. The court in the instant case had taken no action in the matter except to receive the pleas of defendant. This Court has spoken upon the timeliness of an affidavit of bias and prejudice in several cases. State v. Neil, 102 Ariz. 110, 425 P.2d 842; Hendrickson v. Superior Court, etc., 85 Ariz. 10, 330 P.2d 507, 73 A.L.R.2d 1235; Marsin v. Udall, 78 Ariz. 309, 279 P.2d 721. In State v. Neil, supra, we said:
“This court has held that the rules of law pertaining to change of judge are essentially the same in civil cases as in criminal cases. Marsin v. Udall, 78 Ariz. 309, 279 P.2d 721. The right to a fair trial is a foundation stone upon which our present judicial system rests. Necessarily included in this right is the right to have the trial presided over by a judge who is completely impartial and free of bias or prejudice. In order to insure this right, this court early announced, in the case of Stephens v. Stephens, 17 Ariz. 306, 152 P. 164, that a litigant has a peremptory right of disqualification.”
The test is set forth in State v. Neil, supra:
“The timeliness of the filing of the affidavit has been considered several times by this court. In the case of Allan v. Allan, 21 Ariz. 70, 185 P. 539, it was held the affidavit was not timely where the trial judge had taken depositions in a prior hearing to be used at the trial. However, there were other considerations in the Allan case, as the affiant had not properly presented nor urged his motion. It was there stated that the affidavit would act to disqualify the judge if filed before the trial commences. * *
>¡í í¡í Hí iji íjí
“In Arizona Conference Corp. of Seventh Day Adventists v. Barry, 72 Ariz. 74, 231 P.2d 426, the rule in regard to waiver of the peremptory right was given a more strict interpretation, and the New Mexico rule that the affidavit was timely if filed before the judge has ruled on any contested matter whatsoever was adopted. This statement in the Barry case was later expressly disapproved in Marsin v. Udall, 78 Ariz. 309, 279 P.2d 721. In the Marsin case, supra, this rule was modified to the extent that evidence or ruling of the court on collateral matters not bearing on the final decision did not constitute a waiver of the right to challenge the fairness of the judge.”
In the instant case the judge had not made any ruling which would indicate *159how he felt about the case prior to filing of the affidavit. So the question is solely whether such an affidavit can be filed after a guilty plea. It was evident that the procedure which defendant elected to follow was to enter his plea of guilty, and thereafter have a hearing at which the court would take testimony on facts which defendant felt would mitigate his sentence. This is just as important to defendant as any other procedure. He is entitled to a fair and and impartial court in making the determination as to whether he has shown facts sufficient to mitigate his sentence. His rights to a change of judge are the same after a plea of guilty as after a plea of not guilty. The right of the defendant to file his affidavit of bias and prejudice in the first instance is a right which is given a defendant in every case when timely filed. The real test is whether when a court received a plea it alone has jurisdiction of the case. If such were true then an affidavit of bias and prejudice filed after a plea would not be timely; however, this court has already disposed of this question in the case of Bellamack v. State, 37 Ariz. 344, 294 P. 622, in which we said:
“Defendant cites a class of cases in which mistrials have been declared and judgments vacated because it appeared that a judge was substituted in the course of the trial, and insists that such cases are applicable to the situation here. When the trial is on the merits, for obvious reasons it should be by one judge. But we do not understand that because a judge has taken the plea of the accused and set the date for the trial, as did Judge Phelps in this case, that he must, unless disqualified, try the case.”
We therefore hold that a defendant has the right to file an affidavit of bias and prejudice against a court after a plea of guilty in a case, and that it is timely when filed before judgment and before hearing on mitigation of sentence.
It is ordered that the judgment and sentence of the court be vacated, and defendant be remanded to the Superior Court of Gila County for further proceedings in accordance with this decision.
UDALL, V. C. J., and STRUCKMEYER, BERNSTEIN and LOCKWOOD, JJ., concur.