A defendants motion to disqualify a judge cannot be denied as untimely based on the courts own invalid assignment of the case to itself. Prior to arraignment, the defendant appeared in court without counsel twice before the same judge; the court continued arraignment to allow the defendant to obtain counsel, and assigned the case to itself for all purposes. After counsel was appointed and a preliminary hearing was held, the court arraigned the defendant on the information and again assigned the case to itself for all purposes. Counsel subsequently moved under California Code of Civil Procedure section 170.6 to disqualify the judge. The court issued an order taking the matter under submission pending the outcome of a case then pending in the court of appeal. Later that day, the court issued an amended order nunc pro tunc indicating that the motion was not taken under submission, but was rather denied as untimely. The defendant filed a petition for writ of prohibition, which the court of appeal granted. The appellate court found that the trial courts first order assigning the case to itself for all purposes was of no legal effect, and no other circumstances supported the order finding the 170.6 motion to be untimely. Requiring a defendant to file a peremptory challenge to disqualify a judge too early in the proceedings defeats the purpose of section 170.6, which is to provide the defendant with a reasonable opportunity to challenge a known trial judge. If the challenge must be made very early in the proceedings, the defendant risks wasting the challenge on a judge who will not be assigned to the case for trial. Finding that the lower court erred in assigning the case to itself for all purposes in the initial order, the court ordered the writ of prohibition to issue.