On June 5, 1968, petitioner Gale F. West petitioned the superior court for an order modifying the custody provisions of the divorce decree from his wife Patricia West Fuller. The case was assigned to Judge Edwin Thurston. On September 27, 1968, petitioner filed an affidavit of bias and prejudice against Judge Thurston pursuant to A.R.S. § 12-409, subsec. B, par. 5. The Judge refused to transfer the hearing to another division of the court, and peti*2tioner on October 1, 1968, applied to this court for a writ of prohibition.
On October 15, 1968, we ordered the alternative writ of prohibition to issue to prevent further proceedings in the superior court until further order of this Court. Our reasons follow.
It is well settled that when an affidavit of bias and prejudice is timely filed, the judge has no discretion to do anything further in the case except to transfer the case to another division. We have so construed A.R.S. § 12-409, subsec. B, par. 5. State v. Neil, 102 Ariz. 110, 425 P.2d 842. We have also held that such an affidavit is timely if filed before the judge has ruled on any contested matter. Neil, supra. In Marsin v. Udall, 78 Ariz. 309, 279 P.2d 721, we reaffirmed Stephens v. Stephens, 17 Ariz. 306, 152 P. 164, which held that an affidavit had been timely filed even though the trial judge had previously passed upon certain preliminary matters.
In the instant case, respondent resisted the writ on two grounds:
(1) That the assignment of the case to Judge Thurston was by stipulation. This is denied by petitioner, who alleges that the assignment was made by the Court Administrator. However, we do not pass upon this question for the reason that the record does not show how the case was actually assigned.
(2) That Judge Thurston had ordered a court investigator to check and report on the environmental situation of the minor child. With regard to this, it must be noted that in Marsin, supra, we said:
“As we analyse the previous pronouncements of this court, it has been ruled that when evidence is taken, the right to challenge the judge on grounds of bias and prejudice is waived if the evidence is to be used in the final determination of the case on its merits * * *.
# * Hi * *
“[T]his court is committed to the rule that if a judge is allowed to receive evidence which of necessity is to be used and weighed in deciding the ultimate issues, it is too late to disqualify him on the ground of bias and prejudice.”
In the instant case, petitioner does not deny that, prior to the filing of the affidavit of bias and prejudice, Judge Thurs-ton ordered an investigation of the child’s environment, and petitioner has not denied respondent’s allegation that the investigator’s report was turned in to the court before the affidavit was filed. Petitioner’s response, however, states that (a) the affidavit of bias and prejudice was filed before he had notice of the filing of the investigator’s report, and (b) Judge Thurs-ton stated that the report would not be considered as evidence.
It is clear that the object of our rules in connection with affidavits of this kind is to give every litigant one “peremptory” challenge of the judge to whom the case is assigned, provided that the challenge is made before the progress of the case has given him an idea of how the judge is going to rule. He is not permitted to wait until he sees which way the decision is going to go before deciding whether to stay with or try to eliminate the judge who is hearing the matter. Nor is he permitted to wait until the judge has heard evidence on the merits, which will have to be resubmitted if another judge is substituted.
In the instant case it is our opinion that at the time the affidavit of bias and prejudice was filed, petitioner had not yet found any reason to believe that the judge was going to rule against him, and there is no showing—or even an allegation—that the judge had read the investigator’s report. In any event, if there is any doubt it ought to be resolved in favor of the affiant, as the substitution of an impartial judge cannot in any way prejudice the opposing party, but the failure to take the case out of the hands of a judge whom the affiant thinks is biased may harm the affiant and certainly will *3tend to diminish his respect for the administration of justice.
For the above reasons, the alternative writ was issued, and it is now ordered to be made permanent.
UDALL, V. C. J., and STRUCKMEYER, BERNSTEIN and LOCKWOOD, JJ., concur.