
170 Cal.App.3d 773 (1985)
216 Cal. Rptr. 539
In re RONALD A. JACKSON on Habeas Corpus.
Docket No. F005401.
Court of Appeals of California, Fifth District.
July 29, 1985.
*775 COUNSEL
Eugene F. Toton for Petitioner.
Edward R. Jagels, District Attorney, and Stephen M. Tauzer, Deputy District Attorney, for Respondent.
OPINION
HAMLIN, J.
Petitioner Ronald A. Jackson, an attorney at law, seeks a writ of habeas corpus requiring respondent Kern County Superior Court to *776 vacate its findings of contempt and its orders remanding petitioner to the custody of the Kern County Sheriff. The petition requires us to decide the effect of a substitution of attorney (substitution) signed by the defendant in a criminal proceeding and his retained attorney. The substitution removes petitioner, the retained attorney, and substitutes the defendant in pro. per. However, the defendant signed the substitution prepared by his attorney with the intent to request the court immediately to appoint an attorney to represent him. We conclude that such a substitution constitutes an application for relief addressed to the discretion of the court; we will deny the writ of habeas corpus.

Procedural and Factual Background
This petition stems from a criminal action in which the jury convicted John Andrew Stoll (defendant) of 18 counts of violating Penal Code section 288, subdivision (a). Defendant's mother had made arrangements with petitioner to represent defendant in the trial. Petitioner underestimated the duration of the trial. About halfway through, petitioner asked defendant's mother for more money. Neither she nor defendant was able to pay more. Petitioner advised the court of the situation and asked the court to appoint him to represent defendant from that point on. The court did not rule on petitioner's request for court appointment as defendant's counsel.
Sentencing was set for four weeks after the jury returned its guilty verdict. That hearing was continued to February 28, 1985, at petitioner's request. On February 28 petitioner appeared and moved on behalf of defendant for a continuance. Petitioner then handed the clerk a substitution signed by petitioner and defendant, substituting defendant in pro. per. for petitioner. Petitioner then told the court that defendant wished to have a court-appointed attorney assist him in preparing a motion for a new trial. Petitioner also reminded the court it had not ruled on his motion to have the court appoint him as counsel for defendant. He also explained that he had only been retained for trial and that he had not been paid to represent defendant on the motion for new trial or at sentencing. He also stated that the requested continuance was to permit defendant to request the appointment of an attorney to assist him.
The trial court considered that petitioner was moving to be relieved as counsel for defendant. The court "denied the motion" and ordered petitioner to proceed. He refused. After discussions on the record with defendant and both counsel produced no agreement, the matter was continued to March 14.
The substitution which petitioner handed the sentencing judge's clerk on February 28 was later returned to petitioner. On March 11 that substitution was filed in the office of the county clerk.
*777 Petitioner failed to appear for the continued sentencing hearing on March 14. The court found petitioner in contempt and ordered the bailiff to apprehend him. When he was brought into the courtroom a few minutes later, he again refused to represent defendant. He argued that the substitution signed by him and defendant made court approval of the termination of his services unnecessary and that the court, therefore, lost jurisdiction to impose sanctions against him. The court rejected petitioner's argument and imposed a five-day jail sentence, but stayed execution until March 18, the time previously set for defendant's sentencing.
On March 15, this court stayed enforcement of the contempt adjudication until March 26, 1985. Petitioner appeared with counsel on March 18 and reiterated his refusal to represent defendant. He was again found in contempt and given an additional five days in jail.
The next day, the court relieved petitioner as counsel for defendant and, pursuant to defendant's request, appointed another attorney to represent defendant. Sentencing was then continued to June 12 to allow time for preparation of a transcript of defendant's trial and its review by defendant's newly appointed attorney.

DISCUSSION

I. Jurisdiction.

(1a) Petitioner contends his employment contract with Stoll terminated at the end of the trial. At that time, pursuant to Code of Civil Procedure section 284,[1] subdivision 1, petitioner filed a substitution placing defendant in pro. per. as the attorney of record. Petitioner argues that since this was a substitution of attorneys and not an application for relief of an attorney (§ 284, subd. 2), the court had no jurisdiction or power to refuse the substitution. From this he asserts the substitution removed petitioner from the case and the court had no power to order petitioner to continue to represent defendant.
Petitioner distinguishes the cases cited by respondent because they dealt with relieving attorneys of record. In such cases, petitioner concedes the *778 court has power to exercise discretion in granting or denying the attorney's application to be relieved (§ 284, subd. 2).
(2) In considering an application for writ of habeas corpus arising out of a contempt adjudication "the sole question before us is one of jurisdiction of the trial court to render the judgment under review, and in such a case the review of the evidence is limited to determining whether there was any substantial evidence to sustain the jurisdiction of the trial court." (The Times-Mirror Co. v. Superior Court (1940) 15 Cal.2d 99, 115 [98 P.2d 1029], rev. other grounds (1941) 314 U.S. 252 [86 L.Ed. 192, 62 S.Ct. 190, 159 A.L.R. 1346].) (3) It is well established that a court has inherent power to punish for contempt of court. (In re Buckley (1973) 10 Cal.3d 237, 247 [110 Cal. Rptr. 121, 514 P.2d 1201, 68 A.L.R.3d 248].) This inherent power "`is a necessary incident to the execution of the powers conferred upon the court, and is necessary to maintain its dignity, if not its very existence.'" (Id., at pp. 247-248, quoting In re Shortridge (1893) 99 Cal. 526, 532 [34 P. 227].) However, contempt "is a drastic remedy which should be used only when necessary in order to maintain law and order." (Uhler v. Superior Court (1953) 117 Cal. App.2d 147, 156 [255 P.2d 29].)
(4) Once a court has jurisdiction and makes a ruling, an attorney has a duty "to respectfully yield to the rulings of the court, whether right or wrong. [Citation omitted.] `[I]f the ruling is adverse, it is not counsel's right to resist it or to insult the judge  his right is only respectfully to preserve his point for appeal.'" (Hawk v. Superior Court (1974) 42 Cal. App.3d 108, 126 [116 Cal. Rptr. 713], quoting Sacher v. United States (1952) 343 U.S. 1, 9 [96 L.Ed. 717, 723, 72 S.Ct. 451].)
(5) Section 284, quoted above, is applicable to criminal as well as civil cases. (Smith v. Superior Court (1968) 68 Cal.2d 547, 558 [68 Cal. Rptr. 1, 440 P.2d 65].) That statute serves to secure the right to representation by counsel. (In re Martinez (1959) 52 Cal.2d 808, 814 [345 P.2d 449].)
(1b) Petitioner's argument that the trial court had no jurisdiction to order him to continue to represent defendant after he filed the substitution of attorney signed by him and defendant assumes there was a substitution within the meaning of section 284, subdivision 1. Petitioner's assumption is warranted only if the document petitioner filed accomplished a change of attorney without requiring court action. By its express terms section 284 governs a change of attorneys.
When petitioner arranged to have his client sign the substitution, petitioner knew his client was indigent. That was the reason petitioner prepared and filed the substitution  he had not been paid an additional fee to continue *779 his representation because defendant's mother and defendant had no funds to pay him. Additionally, petitioner knew defendant was not prepared to represent himself. In the declaration petitioner filed in support of his petition for a writ of habeas corpus he stated, among other things:
"10. After the trial, I informed Mr. Stoll [defendant] that a motion for new trial should be made as well as preparation of the record for appeal. I further advised him that I had not been engaged for ths [sic] purpose and would not act as his attorney in these matters unless retained or appointed to do so. I advised him it would be appropriate to substitute in as his own attorney and then request appointment of an attorney to assist him in these motions."
Petitioner emphasizes his reliance on the effect of the substitution he handed the trial court when he appeared at the continued sentencing hearing on February 28, 1985. He points to defendant's answers at that hearing to the court's questions about self-representation in support of his argument that the document he filed was a change of attorneys within the meaning of section 284, subdivision 1. However, petitioner's argument ignores the trial court's finding at the conclusion of those questions that defendant did not wish to represent himself at that point. That finding is supported by the inferences reasonably drawn from all that occurred at that hearing. At the outset of the hearing petitioner stated:
"I'm handing to the Court, your Honor, the clerk, an original and copy of a substitution of attorneys. [¶] Mr. Stoll [defendant] wishes to represent  or to proceed to obtain a Court-appointed attorney to assist him in the matter of preparing a motion for a new trial." Later he reiterated:
"Since I was not retained for that purpose and have no authority to proceed, and since I have not been appointed, I think it is appropriate at this time for the Court to continue the issue of sentencing for a period of two weeks, to allow Mr. Stoll to request the appointment of an attorney to assist him in motions for new trial, and any other matters that he may wish to  that the attorney may wish to present to the Court."
This is not a situation in which the defendant made a request to discharge his retained attorney. (See People v. Stevens (1984) 156 Cal. App.3d 1119 [203 Cal. Rptr. 505].) Defendant never said he was dissatisfied with petitioner's services. There is nothing in the record to suggest that defendant did not want petitioner to continue to represent him  he simply could not pay him. Defendant never mentioned any other reason for signing the substitution.
*780 From the quoted statement in petitioner's declaration it appears that petitioner was cognizant that the court was under an absolute duty to appoint counsel for his indigent client when he was no longer represented. (Gideon v. Wainwright (1963) 372 U.S. 335 [9 L.Ed.2d 799, 83 S.Ct. 792].)
In the circumstances of this case the filing of the substitution was the functional equivalent of an application by petitioner to be relieved of the responsibility of further representing defendant without being paid. Defendant's signature on the substitution indicated nothing more than mere acquiescence in his attorney's request for leave to withdraw. (See People v. Mullane (1960) 182 Cal. App.2d 765, 770 [6 Cal. Rptr. 341].)
In Mullane the defendant contended on appeal that he was denied the right to have the aid of counsel of his choice by the trial court's denial of his motion to dismiss his attorney. The court stated its rationale for rejecting the defendant's contention: "When the matter came on for hearing for probation and sentence, defendant's counsel asked to be relieved of further representation of defendant. The court inquired of defendant if that was his desire and his response was that it was agreeable to him for the reason that his counsel had not been paid and he had nothing to pay her. No other ground or basis to substitute counsel appears. The request of defendant's counsel to be relieved was denied. Defendant's mere acquiescence in his attorney's request for leave to withdraw does not constitute a request on his part for a substitution of attorneys. Notwithstanding the right of an accused to represent himself or to representation by an attorney of his own choice, the right is one which must be exercised seasonably and not through mere caprice." (People v. Mullane, supra, at p. 770.)
When viewed in the light of the impact on the smooth course of administration of justice, the substitution filed by petitioner was no different from an application for leave to withdraw. In either case petitioner would no longer be representing defendant and the court would have to appoint a new attorney to take over after a long trial involving testimony from numerous witnesses over a three-month period. Since the substitution petitioner filed presented to the court the same problems as an application for leave to withdraw, there is no reason to require court approval for one and not the other.
Our conclusion that a change of attorneys within the meaning of section 284, subdivision 1, occurs in criminal cases only when the party substituted in as attorney for the defendant actually intends to act as such coincides with the public policy behind the enactment of that section. The statute is designed to secure the right to representation. (In re Martinez, supra, 52 Cal.2d at p. 814.)
*781 This policy is also evident in other states where statutes provide that in order to have a substitution there must be another person ready and willing to step in as attorney of record. (McLaughlin, Supplementary Practice Commentary C321.1, N.Y. Civ. Prac. Rules (McKinney 1984-85 pocket supp.) rule 321, subd. (b); Ariz. Rev. Stats. Ann. (1984-85 pocket supp.) Rules of Crim. Procedure, rule 6.3(c); Kan. Stats. Ann. (1981 pocket supp.), Rules, District Courts 60-2702a, rule 117; Ill. Ann. Stats., ch. 110A (Supreme Ct. rule 13 and committee coms. (Smith-Hurd 1985)).)
Thus, the procedure utilized by petitioner was properly considered by the trial court as a section 284, subdivision 2, application which the court clearly had jurisdiction to grant or deny. Petitioner may have disagreed with the court's denial, but, as an officer of the court, he should have obeyed the order that he continue to represent defendant and then appeal if there was error. (Hawk v. Superior Court, supra, 42 Cal. App.3d 108.)

II. Second Contempt Adjudication.

(6) Petitioner contends in the alternative that even if the trial court had jurisdiction to order him to continue to represent defendant, a second contempt adjudication for the same course of conduct violated his constitutional rights.[2] He cites no authority in support of this proposition. The argument he advances is that the court's conduct cannot be considered reasonable. "The extension of this procedure is that petitioner could be daily ordered back before the trial court." A similar argument was considered and rejected by our Supreme Court many years ago in Ex parte Stice (1886) 70 Cal. 51, 58 [11 P. 459]:
"Now, it is contended that the refusal to be sworn in the same case is but one offense; that Stice had refused to be sworn on the 29th of February, 1886, for which he had been punished under the order of that date; that when he refused to be sworn on the 1st of March he was guilty of the same offense, and no other, for which he had been punished by the order of the 27th of February; that the penalty inflicted by the order last in date is an additional punishment for one and the same offense, which the court was without jurisdiction to impose.
"We do not think that the refusal to be sworn on the 1st of March was the same offense for which the petitioner had already been punished. On the contrary, we think it was a different one.
*782 ".... .... .... .... .... .... .
"It is argued that if the law be such as is here held, there will be no limit to the making of such orders; that a party may be called as a witness every day or very [sic] hour in the day during a protracted trial, and on each refusal to be sworn a penalty might be inflicted, to the great oppression of the subject of it. Such a course would be a great and unjustifiable abuse of power. There is no such case before us. Nor do we anticipate that such an extreme course will be pursued by any court."
Here, petitioner was in substantially the same position as the recalcitrant witness in Stice. Punishment had already been imposed for one disobedience of the court order when the contemner disobeyed the same order a second time. In each case the contemner still had the power to perform what he was ordered to perform when he disobeyed the order the second time, and it was not unreasonable for the court to believe the punishment imposed for the first contumacious act might well convince the contemner he should do what he was ordered to do. As in Stice, the case before us is not one of repeated findings which constitute an unjustifiable abuse of power.[3]
We conclude that the trial court reasonably ordered petitioner to return to court on the date set for defendant's sentencing, and when petitioner on that date again refused to represent defendant the court properly adjudicated petitioner in contempt a second time.
The petition for a writ of habeas corpus is denied. The order staying enforcement of the adjudication of contempt against petitioner is dissolved and the order to show cause previously issued is discharged.
Hanson (P.D.), Acting P.J., and Best, J., concurred.
Petitioner's application for review by the Supreme Court was denied October 3, 1985.
NOTES
[1]  The statute provides:

"The attorney in an action or special proceeding may be changed at any time before or after judgment or final determination, as follows:
"1. Upon the consent of both client and attorney, filed with the clerk, or entered upon the minutes;
"2. Upon the order of the court, upon the application of either client or attorney, after notice from one to the other."
All further statutory references are to the Code of Civil Procedure unless otherwise indicated.
[2]  United States Constitution, Fifth Amendment; California Constitution, article I, section 15.
[3]  Petitioner's second refusal to continue to represent defendant is to be distinguished from the situation in which the court attempts to impose punishment for multiple contempts on the same day after the contemner has made his position clear. (See In re Keller (1975) 49 Cal. App.3d 663 [123 Cal. Rptr. 223].)
