
209 Cal.App.2d 262 (1962)
In re HARRY ELIAS on Habeas Corpus.
Crim. No. 60. 
California Court of Appeals. Fifth Dist.  
Nov. 5, 1962.
 George & Powell and Jay W. Powell for Petitioner.
 Clarke Savory, District Attorney, John D. McFeeters, Deputy District Attorney, and Daniel C. Miller for Respondents.
 CONLEY, P. J.
 Harry Elias petitioned this court for a writ of habeas corpus by which he seeks release from the custody of the Sheriff of Fresno County by reason of a commitment for civil contempt ordered by the superior court in the case of Industrial Asphalt of California, Inc. v. Harry Elias & Columbia Casualty Company, Fresno County No. 115247.
 One of the considerations leading to the issuance of the writ by this court was the recital in the petition that upon the presentation of a substantially identical petition to the Fresno County Superior Court said court "... took no formal action and refused to entertain ... such petition ... on the ground it had no jurisdiction to hear the petition, and that the proper court to hear it was the Fifth Appellate District Court of Appeal."
 Assuming that the sole ground for the refusal was as alleged, the superior court was in error, for the judges of that court had the duty to consider the application and, if the petition was meritorious, to issue the writ even though the legality of an order of commitment previously made by that court was under attack.
 Historically and practically, the writ of habeas corpus is one of the most important legal safeguards of the American citizen.
 "A free people venerate this ancient writ ... as a fundamental guaranty and protection of their right of liberty and as the most effective remedy known to the law for securing release from unlawful restraint." (25 Am.Jur., Habeas Corpus,  2, p. 144.) *264
 [1] By our state Constitution the judges of the superior court are expressly authorized to issue the writ (Cal. Const., art. VI,  5), having an equal initial right in this respect with the justices of the Supreme Court and of the District Courts of Appeal.
 [2, 3] Habeas corpus is concerned only with jurisdiction; it can not be invoked for the purpose of correcting errors in a trial record, except those relating to jurisdiction; the superior court should not refuse to consider a petition for a writ of habeas corpus on the ground that the validity of an order of the same court is under attack. For obvious reasons, particularly where the taking of evidence is involved, the local court is often better able to render timely and effective relief than a court of appeal, and it is for this reason that appellate courts frequently refuse to issue the writ unless application has first been made therefor to the superior court or unless a good reason is shown in the petition for failure to have made such application. (24 Cal.Jur.2d, Habeas Corpus,  68, pp. 522-526;  76, pp. 541-542; In re Brune, 113 Cal.App. 254 [298 P. 80]; In re Trainor, 5 Cal.App.2d 593 [43 P.2d 579]; 39 C.J.S., Habeas Corpus,  78, pp. 623-624.)
 [4a] The return filed by the sheriff showed that Harry Elias is in custody by virtue of a warrant of commitment issued October 3, 1962, for contempt in that, having the ability to do so, he failed and refused to pay into court the sum of $39,000, as ordered by the Superior Court of Fresno County. The petition for the writ was by agreement of the parties considered to be the traverse of the return. It was further stipulated that for the purpose of this proceeding the entire contents of the file in Industrial Asphalt of California, Inc. v. Harry Elias & Columbia Casualty Company, Fresno County No. 115247 should be considered in evidence. No additional evidence was offered by either party.
 Action No. 115247 was commenced in the Superior Court of the County of Fresno on May 18, 1962, by the filing of a complaint by Industrial Asphalt of California, Inc., a California corporation, against Harry Elias and his surety, Columbia Casualty Company, a New York corporation. The complaint is in two counts. In the first cause of action it is alleged that the County of Kings, State of California, entered into a contract with Harry Elias on February 21, 1961, by which he promised and agreed to install street paving, a domestic water supply, a sewer system and a drainage system in Armona Estates, a subdivision in Kings County, and that *265 before entering into the performance of said work Mr. Elias, as principal, and the defendant surety company made, executed and delivered to the County of Kings their written contract and bond, by the terms of which it was provided that if the contractor or any subcontractor failed to pay for materials or supplies or for work or labor done, the principal and the surety would pay for the same and that in case an action were brought upon the bond a reasonable attorney's fee would be paid to the prevailing party; that said bond inured to the benefit of all materialmen and laborers who might work upon the project; that the work called for by said contract was completed, that it was accepted by Kings County and that notice of acceptance and completion was recorded November 22, 1961; that between August 25 and November 16, 1961, the plaintiff sold and delivered to the defendant contractor, goods, wares and merchandise including rock, sand, gravel, untreated rock base and asphalt paving materials, furnished transportation thereof and paid the sales tax thereon in the total reasonable and agreed sum of $27,855.62. The complaint further alleges that during the years 1961 and 1962 plaintiff furnished material and labor to the defendant contractor on various jobs and that one of them was for the Department of Public Works of the State of California involving the construction and improvement of a portion of Mt. Whitney Avenue near Riverdale in Fresno County; that from time to time plaintiff received sums of money from the defendant contractor on account of said various jobs; that on February 6, 1962, plaintiff received from defendant contractor the sum of $44,898.27, of which plaintiff applied the sum of $22,938.34 in full payment of the balance owing to plaintiff from said defendant contractor, on the Armona Estates contract; that the balance of said payment of $44,898.27, being the sum of $21,959.93, was applied by plaintiff on account of said Mt. Whitney job; that a dispute has arisen between the defendant contractor and plaintiff as to the correct application of said sum of $44,898.27 in that the defendant contractor contends that all of said sum should have been applied to said Mt. Whitney job. The pleading continues by stating that in the event such contention of defendant contractor is determined to be correct, there would remain an unpaid balance due plaintiff for materials and labor furnished on said Armona Estates job in the sum of $22,938.34; that in such event no part of such sum would have been paid to plaintiff, and defendants would be liable to plaintiff in said amount under *266 the provisions of the bond above alleged. The further request is made for $2,500 as attorneys' fees.
 The second cause of action in the complaint alleges that on or about September 15, 1961, the State of California entered into a written contract with Elias by the terms of which he agreed to furnish work and materials for the grading and servicing of a section of the state highway in Fresno County on Mt. Whitney Avenue, which was known as the Mt. Whitney road job; that the contractor entered upon the performance of said work and that a bond was furnished by the defendant surety company; that by its terms said bond inured to the benefit of any and all materialmen, persons, companies or corporations furnishing materials or labor; that the work was finished and a notice of acceptance and completion was filed and recorded on or about April 6, 1962; that between December 26, 1961, and April 4, 1962, plaintiff sold and delivered to the contractor at his special instance and request materials, together with the transportation of the same, of the reasonable and agreed sum of $127,500.66 and that payment for the materials, equipment and labor so furnished was covered by the bond in question; that the application made by the plaintiff of the payment of $44,898.27, as alleged in the first cause of action, namely, $22,938.34 in payment of the balance of the Armona Estates job and $21,959.93 on the Mt. Whitney job, was correct in the opinion of plaintiff; that said sum of $21,959.93 was the only amount paid to plaintiff by the contractor on said Mt. Whitney job and that there is left a balance unpaid on account of said job of $105,540.73. Request is also made for the payment of a $2,500 attorney's fee.
 The prayer of the complaint on the first cause of action is that if the defendant contractor's contention relative to the application of payments to plaintiff is determined to be correct, plaintiff be awarded judgment for $22,938.34, together with interest, $2,500 attorneys' fees and costs. The prayer as to the second cause of action asks for the sum of $105,450.73, less any amount that the court may award plaintiff as principal under the first cause of action, together with interest, attorneys' fees and costs.
 The defendant surety company filed an answer denying that any sum is due plaintiff and a cross-complaint alleging that in reliance upon an agreement of indemnity executed by the cross-defendants, Harry Elias and Patricia Elias, his wife, the cross-complainant executed its bonds Nos. 449564 and 405412 in the penal sums of $126,141.25 and $55,423, as surety *267 for the contractor; that the surety has been sued by a subcontractor for sums in excess of $105,000; that by the agreement of indemnity above referred to the contractor agreed to indemnify the surety against any and all liability arising out of the matters bonded against; that the contractor and his wife further agreed in their contract that they would hold all money derived from construction contracts in trust for the benefit of the surety and that such money would be used for the purpose of completing and performing their construction contracts and discharging the obligation of the bonds and for no other purpose. The cross-complaint further alleges that the cross-defendants have failed and refused to deposit collateral or other security or to apply the proceeds derived from their construction contracts toward discharging the obligation of the surety on its bonds, despite demand having been made therefor; that the said Harry Elias has withdrawn from deposit cash in excess of $65,000 and refuses to apply the same toward the claims of plaintiff or the claims of other subcontractors, laborers and materialmen or to deposit the same with the cross-complainant, or with his attorneys or in any other place of safekeeping to secure it against claims of plaintiff and of other subcontractors, laborers and materialmen; that of the funds so withdrawn from deposit, the sum of $51,741.32 was received by him on the 6th day of April, 1962, as the proceeds of the Mt. Whitney contract; that said sum was produced as the result of the work, labor and materials furnished by the plaintiff subcontractor herein and other claimants. It is further alleged that pursuant to the law of the State of California such funds are required to be applied in the first instance to the payment of claims of such subcontractors, laborers and materialmen whose work and materials were used in completing the Mt. Whitney job and in producing the said funds; that Harry Elias has recently performed other allegedly irrational, unusual and peculiar acts in the presence of and to the knowledge of the cross-complainant and that it apprehends the loss or destruction of the said sum by fire, theft, burglary, diversion, dissipation or other hazards; that the said contractor appears to have no other estate or assets sufficient to indemnify and secure the surety company from the claims of plaintiff herein or to pay other claimants on works of improvement described in the complaint. The surety asks that all persons having claims against the contractor be joined as parties to the litigation.
 Petitioner Harry Elias has never answered the cross-complaint, *268 he having secured time from the court by successive orders within which to file an answer. The last order extends his time to answer to November 23, 1962.
 There are, however, other pleadings in the case. The defendant Elias filed a demurrer to the cross-complaint, which in due course was overruled. His demurrer to the complaint was also overruled, and he filed an answer to the original complaint denying that any sum is due or payable to plaintiff and a cross-complaint in which he claims that by reason of carelessness and negligence of the plaintiff in the supplying of aggregates and other paving material he has been damaged in the sum of $94,818.96.
 We now come to the particular proceedings which led to the commitment of the petitioner for contempt. On May 31, 1962, the court commenced a hearing at the instance of the Columbia Casualty Company on an order to show cause why Elias should not be required to deposit in court any sum of money in his possession derived from the state by reason of the Mt. Whitney job. Extensive evidence was received, and the matter submitted for decision on August 16, 1962. The result was an order for deposit in court by Elias of the sum of $39,000 pursuant to the provisions of section 572 of the Code of Civil Procedure. The court made findings of fact preliminary to the order as follows:
 "That on or about the first day of April, 1962, Harry Elias received a warrant from the State of California in partial payment for work performed by him as general contractor upon the Mt. Whitney job and that he converted said warrant into cashier's checks and thereafter changed the checks into cash; that ever since the 11th day of June, 1962, he has had in his possession or within his immediate custody and control and now has at the time of the making of the order the sum of $39,000 constituting the balance now remaining of the proceeds of the said State Warrant of $51,741.32 and that he presently has the ability to deliver up the said sum of $39,000 and to deposit it with the clerk of the court."
 The court held as conclusions of law that the $39,000 in the possession or within the immediate custody and control of the cross- defendant, Harry Elias, are trust funds for the benefit of the cross- complainant, Columbia Casualty Company, a corporation; that "[a]s stipulated by counsel for the parties hereto, the said funds so received from the State of California ought to be applied first to the payment of claims of subcontractors and materialmen and laborers on said work of improvement *269 before being used for any purpose, so that the cross-complainant, Columbia Casualty Company, a corporation, may be relieved, to that extent, from the claims of subcontractors, materialmen and laborers of the said cross-defendant, Harry Elias, arising out of the performance of said work of improvement"; and that the cross-complainant is entitled to have an order of the court requiring the cross-defendant, Harry Elias, forthwith to deliver up to and deposit with the clerk of the court said sum of $39,000.
 The order follows: "Good cause appearing therefor, it is hereby ordered that the cross-defendant, Harry Elias, deliver up to and deposit with the clerk of this court at the offices of the County Clerk of Fresno County, California, and within 72 hours from the time of the service of the certified copy of this order, the said sum of $39,000, the same to be held and safely kept by said Clerk pending the further order of this court."
 The attorney for Columbia Casualty Company filed an affidavit on September 17, 1962, which recited the making of the order, service of a certified copy thereof upon Elias in the County of Fresno on the 4th day of September, 1962, and the fact that "... the said defendant and cross-defendant, Harry Elias, having the ability to do so, has failed and refused to deposit the said sum of $39,000 with the clerk of this court." The affidavit concludes with the prayer that an order to show cause be issued requiring him to appear before the court in department 5 thereof on September 24, 1962, at 9 a. m. to show cause, if any he have, why he should not be punished for contempt. The file shows that petitioner was served with a certified copy of this order to show cause on September 17, 1962. Apparently in the absence of Elias, the court held the hearing and thereafter made its order under date of October 3, 1962, finding the said cross-defendant in contempt and directing that he be committed to the custody of the Sheriff of the County of Fresno, unless and until he should deliver up and deposit with the clerk of the court the said sum of $39,000. The order for the issuance of the commitment and the commitment itself are in due form.
 The sole contention made by petitioner's counsel upon the hearing is that the commitment is void because the superior court had no jurisdiction to order the deposit of the $39,000 and that the disobedience of such void order did not constitute contempt. In this connection, it is urged that Mr. Elias denies in his answer to the complaint that he owes any sum to plaintiff; *270 that he has never as yet filed an answer to the cross- complaint of the Columbia Casualty Company and that he therefore has never admitted by any pleading any of the allegations of Columbia Casualty Company; that this case has not been tried, and there is therefore no proof that Elias owes anything to plaintiff or to any other person based on the Mt. Whitney job or that the Columbia Casualty Company will be required to pay any claim by reason of the surety bonds which it has issued; that the counter-claims against plaintiff urged by Elias in his cross-complaint have not been determined; that there is no basis for the contention that he or his surety may be required ultimately to pay any sum to any subcontractor; that the case does not directly involve title to the $39,000; that, therefore, the court had no right under section 572 of the Code of Civil Procedure to require the deposit of $39,000 or any other sum, at least at this stage of the case; and that the order requiring him to do so and the contempt proceedings are consequently void.
 The validity of petitioner's contention depends on whether the prerequisites for an order for deposit in court specified by section 572 of the Code of Civil Procedure have been established. That section reads as follows:
 "When it is admitted by the pleadings, or shown upon the examination of a party to the action, that he has in his possession, or under his control, any money or other thing capable of delivery, which, being the subject of litigation, is held by him as trustee for another party, or which belongs or is due to another party, the court may order the same, upon motion, to be deposited in court or delivered to such party, upon such conditions as may be just, subject to the further direction of the court."
 As we have seen, there is no admission by Harry Elias in any pleading filed up to date that any sum is owed by him to the plaintiff or to any other person; both he and the surety company deny any indebtedness on his part; and it has not been proven that any such sum is in fact due, because the trial has not as yet been held.
 The court below found upon conflicting evidence that Harry Elias has in his possession or under his control the sum of $39,000 and that it is capable of delivery; this issue was hotly contested upon the hearing of the order to show cause, as Elias claims that this money disappeared as the result of a burglary; the petitioner, however, does not raise the point in this court, apparently conceding that the court below had sufficient indirect *271 evidence before it by way of inference that his admitted previous possession still continues, to support the finding.
 Is this money the "subject of litigation"? Certainly, no one can claim that this particular sum is sued for directly. Plaintiff's complaint alleges that a certain balance is due to it from the defendant Elias, but the specific sum here in question is not the subject of the suit.
 Is the money held by Elias as trustee for the Columbia Casualty Company within the meaning of the code section? The "General Application and Indemnity Agreement" executed by Elias and his wife in favor of Columbia Casualty Company reads in part as follows: "We will hold all money or other proceeds of the contract, whether received as payment or loan, as a trust for the benefit of the Company, and use such money or other proceeds for the purpose of performing the contract and discharging the obligation of the bonds, and for no other purpose, until the bonds are completely exonerated."
 Thus, under the agreement the "trust" is to continue only "until the bonds are completely exonerated"; there has been no showing as yet that the bonds are not completely exonerated; if all legal payments which were due from the contractor to subcontractors and others have been made, the bonds would be completely exonerated; proof of this question must abide the trial.
 We turn to cases construing the meaning and effect of section 572 of the Code of Civil Procedure. [5] Ex parte Casey, 71 Cal. 269, 271-272 [12 P. 118], holds: "Section 572 of the Code of Civil Procedure refers to property which is without question in the hands of a trustee as trust property, or which belongs to or is due to another; it does not refer to that where the party alleged to hold as a trustee claims title to it in his own right."
 In Burke v. Superior Court, 7 Cal.App. 178, 181 [93 P. 1058], the plaintiff filed a complaint against stockholders of a corporation, claiming that they owed balances on their subscriptions and alleging that he had been authorized by the corporation to take such steps as might be deemed necessary to obtain an accounting and wind up its affairs, pay its debts and distribute the remaining assets to the stockholders. In their answers and cross-complaints the defendants alleged that plaintiff, as an officer of the corporation, held $2,050 of the corporate funds in trust for its use and benefit and prayed that *272 he be required to deposit said money in court. In his answer to these cross-complaints, plaintiff admitted that he held the funds as trustee but alleged that he was entitled to certain offsets against it and that part of the monies were in truth and in fact due to him. Upon the pleadings, cross-complainants moved for an order requiring plaintiff to deposit the $2,050 in court. The lower court granted the motion, and thereafter plaintiff unsuccessfully moved to vacate the order; thereafter the plaintiff was served with an order to show cause why he should not be adjudged guilty of contempt, and he applied for a writ of prohibition, which was granted by the District Court of Appeal. In the opinion written by Mr. Justice Shaw it is pointed out:
 "His answer showed that petitioner claimed the right to part of the fund in his possession, and the court was without jurisdiction to compel him to surrender to another what he claimed to be his property, until there had been a judicial determination, upon the hearing of all the facts, that he had no right to it. To justify the making of the order, the admission in the pleadings of having money in possession belonging to another must be free from any claim thereto. ..."
 "Furthermore, the fund must, under the provisions of said section, be the 'subject of the litigation.' 'If the money in the possession of the party is not the subject of the litigation, but its payment is an incident thereto, dependent upon the judgment to be rendered in the action, as in the case of an action for ... accounting ... the provisions of this section do not authorize such order.' (Green v. Duvergey, 146 Cal. 379 [80 P. 234].) The pleadings clearly show the action to be one having for its purpose the procuring of an accounting between the corporation and its stockholders, and to determine the amount of money in the possession of any of the parties to the action belonging to the corporation, with a view of having it paid into court and winding up the corporate affairs."
 "In our judgment the pleadings do not disclose the requisite facts necessary to confer jurisdiction upon the court to make the order requiring a deposit of the money in court. The order is, therefore, void, and being void, it follows that the court had no jurisdiction to entertain any subsequent proceedings based thereon and instituted for the purpose of having the petitioner adjudged guilty of contempt for disobedience of such order."
 [6] In the leading case of Green v. Duvergey, 146 Cal. 379, 385 [80 P. 234], it is said: "A party to a controversy *273 involving a right to a certain sum of money cannot be required to pay that money into court, unless it is either clearly admitted by him in his pleading or shown in some proceeding in the cause that he has himself no right to retain it, and that his antagonist is entitled to it, or at least has an absolute interest therein. Such admission must be free from any condition, and the antagonist must himself claim an immediate right to the money before he can ask that it be deposited in court. If the admission make the right of the other party dependent upon his performance of some condition, or if the other party does not claim any right to the money, or disputes the existence of the condition, the court will not order the money to be deposited before a hearing in the cause and a judicial determination of the respective rights of the parties, for the reason, as given by Lord Cairns in Hagall v. Currie, L.R. 2 Ch.App. 449, that 'if money is ordered to be brought in, which is not clearly due, very gross injustice may be done, as the defendant may be put to great inconvenience, and afterwards be told that his view of the case was correct.' [7] A court ought not to require a litigant to surrender his property to another, or for his benefit, until there has been a judicial hearing and determination that he has no right to such property; but an order that he pay money into court without such hearing is, in effect, an arbitrary judgment against his right to its possession. The principle upon which the rule rests was very fully considered in McKim v. Thompson, 1 Bland. 150, wherein it was held that the order for such payment must depend upon a judicial determination, upon the facts as then shown to the court, that the party from whom the payment is asked has no right or title to hold the money, and that he cannot be allowed at any subsequent stage of the cause to contradict or explain away those facts. The same principle was declared by Lord Cottenham in Richardson v. Bank of England, 4 Mylne & Co. 165. (See also Peacham v. Daw, 6 Madd. 98; Hopkins v. McEldery, 4 Md. Ch. 23; McTighe v. Wadleigh, 22 N.J. Eq. 81; Daniell on Chancery Practice,* 1780.) ... If the money in the possession of the party is not the subject of the litigation, but its payment is an incident thereto, dependent upon the judgment to be rendered in the action, as in the case of an action for redemption, specific performance, accounting, rescission, or the like, the provisions of this section do not authorize such order; and in all cases when it may be made it must appear that the party holds *274 the money as trustee, or that it 'belongs or is due to another party.' "
 The following comment on the case of Green v. Duvergey, supra, is made in Frey v. Superior Court, 22 Cal.App. 421, 425 [134 P. 733]: "The rule recognized in interpreting section 572 of the Code of Civil Procedure, is laid down in Green v. Duvergey, 146 Cal. 386 [80 P. 234], which, in substance, is that the right to make the order depends upon the facts shown to the court, an essential being that the party from whom the payment is asked has no right or title to hold the money, and that it belongs to or is due another."
 A summarization of California law on the subject is thus made in 23 California Jurisprudence 2d, Funds and Deposits in Court, section 5, pages 568-569: "The right of the court to make an order for deposit or delivery depends on the facts as shown to the court. A party to a controversy involving a right to a certain sum of money or thing cannot be required to deposit that money or thing in court unless it is either clearly admitted in his pleading or shown in some proceeding in the cause that he has himself no right to retain it and that the other party to the action is entitled to it or at least has an absolute interest in it. In all cases it must appear that the party holds the money as trustee, or that it belongs or is due to another party. If the party alleged to hold as trustee claims title or right to all or part of the funds in his possession, the court is without jurisdiction to compel him to surrender them by ordering a deposit in court, since this constitutes an issue which should not be tried in this summary manner, but one which requires a judicial determination, on the hearing of all the facts, that he has no right to the funds. If it appears from the proceedings that the right of the other party is dependent on his performance of some condition, or if the party applying for the order does not claim an immediate right to the money, or disputes the existence of the condition, the court will not order the money to be deposited before a hearing and judicial determination, in order to avoid the gross injustice of putting a party to great inconvenience before finding his view of the case to be correct."
 "The statute does not authorize an order unless it is shown that a party to the action actually has a fund or property in his possession or under his control. Furthermore, an order is not authorized if the fund or property is not the subject of the litigation, but its payment is merely an incident thereto dependent on the judgment to be rendered, as in the case of *275 an action for redemption, specific performance, accounting, rescission, or the like."
 [4b] In the instant case there is no admission in the pleadings, and there is no proof that either defendant owes any amount to the plaintiff or to anyone else. There is no evidence that the surety company's bonds have not been "completely exonerated" and therefore no proof that any "trust" exists under the "General Application and Indemnity Agreement." The $39,000 is not "the subject of litigation," but is only incidental to it.
 By virtue of the foregoing facts and the authorities cited, the court was without jurisdiction to order the deposit with the clerk, and all subsequent proceedings on the contempt charge, including the commitment, are void.
 The petitioner is discharged from custody on the commitment described in the return.
 Brown, J., and Stone, J., concurred.
