delivered the opinion of the court.
On October 1, 1918, Clara E. Johnson, through the plaintiffs, her attorneys, brought an action in the district court of Yellowstone county against John A. Johnson, her husband, for a divorce on the ground of extreme cruelty. Upon filing the complaint, she made an application for an order requiring the defendant to show why he should not pay her alimony pending the action, including suit money and counsel fees. The application disclosed that she was in ill health and without means to support herself or to pay counsel for services necessary to enable her to prosecute the action. It further disclosed that her husband was possessed of considerable property from which he was receiving a monthly income of approximately $500. Before the hearing was had under the order, and without consulting her attorneys, she became reconciled to her husband and resumed marital relations with him. Later she directed the plaintiffs to dismiss the action, and neither she nor her husband appeared at the time set for hearing under the order. Thereafter plaintiffs brought this action against John A. Johnson, the husband, joining the wife as codefendant, to recover $300, the amount of the fees which the latter had requested the court to allow in her application, alleging that the divorce action had been brought in good faith and that this sum was reasonable compensation for their services rendered therein. To this complaint the defendant John A. Johnson interposed his separate general demurrer. After consideration the court sustained it, and, the plaintiffs standing on their complaint, rendered judgment in favor of this defendant for his costs. Plaintiffs have appealed.
The single question presented for decision is whether, under any recognized rule or principle of law, the plaintiffs are entitled to maintain this action.
It is not entirely clear from the argument found in the [1] brief submitted by plaintiffs, whether their theory is *22that the husband is made liable under section 3677 of the Be-vised Codes, or is liable on the ground that the wife had implied authority under section 3724 to employ counsel- upon his credit as a necessary. Section 3677, so far as it is pertinent here, reads as follows: “While an action for divorce is pending the court or judge may, in its or his discretion, require the husband to pay as alimony any money necessary to enable the wife to support herself or her children, or to prosecute or defend the action. * * * The final judgment in such action may be enforced by the court by such order or orders as in its discretion it may from time to time deem necessary, and such order or orders may be varied, altered or revoked at the discretion of the court.”
We shall not stop to inquire what power the courts in this jurisdiction would have had at common law in divorce cases to require the husband to pay the fees of counsel employed by the wife. The statute declares the extent of the power and, in our opinion, is exclusive; for “in this state there is no common law in any ease where the law is declared by the Code or the statute” (sec. 8060, Bev. Codes), and “the Code establishes the law of this state respecting the subjects to which it relates.” (Sec. 8061.) It requires but a casual reading of section 3677, supra, to ascertain that the object of the legislature in enacting it was to give the courts discretionary power, to be exercised during the pendency of the action upon a proper showing by the wife in an application for that purpose, to compel the husband to provide the means necessary to enable her to prosecute or defend the action. In other words, the power in this behalf conferred by the statute is only ancillary to, or an incident of, an action for divorce. This renders the conclusion necessary that when the main power conferred by this section has ceased to be operative, the ancillary or incidental power also ceases to be operative and cannot be invoked by the wife’s counsel in an independent action to charge the husband.
*23Upon examination of the decided cases in other states which have the same or similar statutory provisions, we find that their courts generally agree that counsel fees may be allowed only while the divorce action is pending. (Loveren v. Loveren, 100 Cal. 493, 35 Pac. 87; Burnham v. Tizerd, 31 Neb. 781, 48 N. W. 823; Clarke v. Burke, 65 Wis. 359, 56 Am. St. Rep. 631, 27 N. W. 22; Isbel v. Weiss, 60 Mo. App. 54; Meaher v. Mitchell, 112 Me. 416, Ann. Cas. 1917A, 688, 92 Atl. 492; Humphries v. Cooper, 55 Wash. 376, 133 Am. St. Rep. 1036, 104 Pac. 606; Beadleston v. Beadleston, 103 N. Y. 402, 8 N. E. 735; Kincheloe v. Merriman, 54 Ark. 557, 26 Am. St. Rep. 60, 16 S. W. 578; Zent v. Sullivan, 47 Wash. 315, 15 Ann. Cas. 19, 13 L. R. A. (n. s.) 244, 91 Pac. 1088.) In some of the states this is held to be the rule independently of the statute, the theory being that the power to allow counsel fees is a mere incident to the general power possessed by the courts to grant divorces. (Kuntz v. Kuntz, 80 N. J. Eq. 429, 83 Atl. 787.) The rule was impliedly recognized by this court in the ease of Bordeaux v. Bordeaux, 29 Mont. 478, 75 Pac. 359; s. c., on rehearing, 32 Mont. 159, 80 Pac. 6. In that case it was held that a district court has no power under the statute to allow counsel fees for past services, even- during the pendency of the divorce proceedings, the only possible exception to this being, perhaps, where the allowance for such past services would be necessary to enable the wife to continue the future prosecution of the action or to make her defense. If the court cannot allow counsel fees for past services, it necessarily follows that it cannot, after the divorce proceeding has terminated, entertain an independent action by counsel against the husband for services rendered for the wife during the pendency of the action.
Nor do we think the action is maintainable on the ground [2] that the services of the plaintiffs were necessary in the sense in which this term is used in section 3724,- supra. This . section impliedly confers authority upon the wife to charge her *24husband as his agent for the value of articles necessary for her support when he neglects to make adequate provision for her, in all cases except as provided by section 3725. Under this section he is not liable for her support if she abandons him until she offers to return to him, unless she was justified by his conduct, in the first instance, in abandoning him. Nor is he liable if she is living separate from him by agreement, unless her support is stipulated for in the agreement. When she is not at fault, she has her option to rely upon the authority given her by section 3724, or, if any ground for divorce exists, she may bring her action for a divorce or for separate maintenance, under section 3643. It is never necessary, however, for the wife to have a divorce, no matter upon what ground she seeks it. The necessaries referred to in section 3724 are such as should be provided by the husband for the wife to sustain her as his wife, and not to provide for her future condition as a single woman, or, perhaps, as the wife of another man. The duty to support the wife grows out of the marital relation, and when the wife seeks to dissolve this relation and set it aside, her want of funds to carry on the litigation is in no sense of the term a “necessary” for her support as a wife.
The legislature in enacting the provisions of the Code— [3] sections 3641 to 3689 — evidently intended to cover the whole subject of divorce and separate maintenance, and by sections 3724 and 3725, and others in pari materia with them, to cover the whole subject of the rights, duties and obligations of the husband and wife, and thus to supplant all rules theretofore in force on the subject. From no point of view do any of them give support to the present action.
We think the judgment of the district court was right, and must be affirmed. It is so ordered.
Affirmed.
Associate Justices Reynolds, Cooper, Holloway and Galen concur.