I respectfully dissent. The issue in this case is whether, after the parties to a marriage have separated, a spouse has the right to encumber his or her one-half interest in community real property without the consent of the other spouse to secure the payment of attorney fees incurred in a marital dissolution proceeding. Construed under well-established rules, the controlling statutes disclose a legislative intent to grant spouses that right. Today’s decision not only contravenes that intent, but will make it virtually impossible for many economically weaker spouses to obtain adequate legal representation in contested divorce proceedings.
I
In 1982, Joanna Droeger (Wife) commenced a marital dissolution action against her husband, John Droeger (Husband), a partner in a San Francisco law firm. She retained the law firm of Friedman, Sloan & Ross to represent her in this action, and entered into a written fee agreement with the law firm.
The litigation was lengthy, as dissolution proceedings sometimes are; Wife was unable to pay her attorney fees on a current basis, and by November 1986 had fallen seriously in arrears. Rather than withdraw as counsel, Friedman, Sloan & Ross accepted a promissory note for its attorney fees from Wife; the promissory note was secured by a deed of trust on her interest *48in certain community real property. Wife executed the promissory note after being advised by the law firm that she had the right to consult independent counsel concerning this transaction.
In December 1986, the parties reached a settlement, which was never implemented. The attorneys for both Wife and Husband successfully moved to withdraw from the case. Wife and Husband apparently remain married, and Wife has never paid her attorney fees.
Friedman, Sloan & Ross did not seek to enforce its deed of trust. But Husband then filed this lawsuit against Friedman, Sloan & Ross, seeking to quiet title and void the deed of trust not only as to his interest in the property but also as to Wife’s interest.
Wife’s financial arrangement with her attorneys is representative of a practice commonly utilized in family law cases. As one manual on California family law observes: “[T]he right to place a lien on the client’s property [in dissolution actions] is often created in the fee agreement to provide security for the payment of fees. Typically, such a lien may be in the form of a second deed of trust on the client’s real property, such as a residence.” (Cal. Family Law Service (1986) Termination of Marital Relationship § 21:18, p. 330.)1 Another legal text advises: “If the money [to pay the attorney a retainer in a dissolution proceeding] cannot be obtained from community bank accounts, the spouse should consider borrowing the money using community property as security . . . .” (3 Markey, Cal. Family Law Practice & Procedure (1991 rev. ed.) § 40.32[4], p. 40-80.)
The common practice of retaining counsel whose fees are secured by a deed of trust is, by its nature, not one that an economically stronger spouse will frequently wish to utilize. Rather, retaining counsel by executing a promissory note secured by a deed of trust on the spouse’s interest in community real property is desirable primarily for those spouses who do not have access to substantial sums of money. For such spouses, the alternative *49may simply be that they will not be represented by a lawyer in dissolution proceedings.
Legal representation in dissolution cases is particularly important when child custody is contested or there are complex property issues, such as determining the value of the other spouse’s business or professional practice. To effectively litigate such issues, an attorney must engage in extensive factual and legal investigations, and must charge correspondingly high attorney fees. Economically weaker spouses who cannot secure payment of attorney fees may be unable to conduct adequate discovery or to sufficiently prepare for motions that may be critical to the outcome of the case. Economically stronger spouses, on the other hand, can afford to protect their interests by funding legal efforts through current earnings or separate property. Thus, spouses who cannot secure their fee obligations through liens on community real property, and are thereby denied the ability to utilize their property to protect their interests, may be unable to meaningfully contest the demands of economically stronger spouses in family law actions.
In marital dissolution proceedings, a trial court may order either spouse to pay the other’s attorney fees. (Civ. Code, § 4370.) But this trial court power does little to assist economically weaker spouses in obtaining representation because attorneys are naturally reluctant to accept a case when they know that payment for their services will be neither prompt nor certain, but will depend on a future and discretionary court order awarding fees in an uncertain and possibly inadequate amount. That court-ordered attorney fees in marital dissolution proceedings are often delayed and inadequate in amount was acknowledged in a recent report of the Judicial Council Advisory Committee on Gender Bias in the Courts, based on a survey conducted in 21 California counties. The report states: “Most counties reported that the majority of family law judges reserve attorney’s fees at the time of the temporary order. . . . Most counties responded that where fees are ordered based upon the ability to pay, they are not adequate. Most respondents noted that this practice adversely affects the ability of the spouse with no income or a very low income, most often women, to retain counsel.” (Advisory Com. Rep. for Judicial Council of Cal., Achieving Equal Justice for Women and Men in the Courts, Draft Rep., Achieving Equal Justice in Family Law (1990) p. 100.) The committee concluded that this situation had contributed to a “crisis in representation” in family law cases. (Id. at p. 106.)
II
Husband contends that the deed of trust given by Wife is void even as to her share of the community property under Civil Code section 5127 (here*50after section 5127). That statute provides in pertinent part: “[B]oth spouses either personally or by duly authorized agent, must join in executing any instrument by which such community real property or any interest therein is leased for a longer period than one year, or is sold, conveyed, or encumbered »
Husband relies on the “plain meaning rule” in support of his argument. (See, e.g., Great Lakes Properties, Inc. v. City of El Segundo (1977) 19 Cal.3d 152, 155-156 [137 Cal.Rptr. 154, 561 P.2d 244].) He argues that one spouse’s interest is “any interest,” and that under the statute’s plain language both spouses must join in an instrument encumbering that interest, or the instrument is entirely void.
“[0]ur first task in construing a statute is to ascertain the intent of the Legislature so as to effectuate the purpose of the law.” (Dyna-Med, Inc. v. Fair Employment & Housing Com. (1987) 43 Cal.3d 1379, 1386 [241 Cal.Rptr. 67, 743 P.2d 1323]; accord, e.g., Altaville Drug Store, Inc. v. Employment Development Department (1988) 44 Cal.3d 231, 238 [242 Cal.Rptr. 732, 746 P.2d 871]; Select Base Materials v. Board of Equal. (1959) 51 Cal.2d 640, 645 [335 P.2d 672].) In doing so, we employ a number of canons of statutory construction, including, when appropriate, the plain meaning rule. But the separate canons are “merely aids to ascertaining probable legislative intent.” (Stone v. Superior Court (1982) 31 Cal.3d 503, 521, fn. 10 [183 Cal.Rptr. 647, 646 P.2d 809].) No single canon of statutory construction is an infallible guide to correct interpretation in all circumstances. We have for many decades adhered to the rule that “ ‘[t]he mere literal construction of a section in a statute ought not to prevail if it is opposed to the intention of the legislature ....’” (In re Haines (1925) 195 Cal. 605, 613 [234 P. 883]; accord, e.g., Lungren v. Deukmejian (1988) 45 Cal.3d 727, 735 [248 Cal.Rptr. 115, 755 P.2d 299].)
Thus, in construing a statute, the task of the court is to determine legislative intent; in doing so, the court should utilize those tools of interpretation that most clearly illuminate the legislative objective.
One “elementary rule” of statutory construction is that statutes in pari materia—that is, statutes relating to the same subject matter—should be construed together. (Hunstock v. Estate Development Corp. (1943) 22 Cal.2d 205, 210 [138 P.2d 1, 148 A.L.R. 968].) We have long recognized the principle that even though a statute may appear to be unambiguous on its face, when it is considered in light of closely related statutes a legislative purpose may emerge that is inconsistent with, and controlling over, the language read without reference to the entire scheme of the law. (E.g., Great Lakes Properties, Inc. v. City of El Segundo, supra, 19 Cal.3d at pp. 155-156; *51Leroy T. v. Workmen’s Comp. Appeals Bd. (1974) 12 Cal.3d 434, 438 [115 Cal.Rptr. 761, 525 P.2d 665].) The rule of in pari materia is a corollary of the principle that the goal of statutory interpretation is to determine legislative intent.
In this case, the surest guide to the intent of the Legislature is a statute that deals with the same subject matter as section 5127 and expresses the Legislature’s approval of the long-standing practice of relying on community real property to secure attorney fees in dissolution cases.
In 1989, the Legislature enacted Code of Civil Procedure section 412.21. Subdivision (a) of Code of Civil Procedure section 412.21 (hereafter section 412.21(a)) provides in relevant part:
“[I]n an action for dissolution of marriage, ... the summons shall . . . contain temporary restraining orders set forth in this section. Upon the filing of a petition for dissolution . . . and issuance of the summons and upon personal service of the petition and summons on the respondent ... a temporary restraining order shall be in effect against both parties until the final decree is entered or the petition is dismissed, or until further order of the court:
“(2) Restraining both parties from transferring, encumbering, hypothecating, concealing, or in any way disposing of any property, real or personal, whether community, quasi-community, or separate, without the written consent of the other party or an order of the court, except in the usual course of business or for the necessities of life and requiring each party to notify the other party of any proposed extraordinary expenditures .... However, nothing in the restraining order shall preclude the parties from using community property to pay reasonable attorney’s fees in order to retain legal counsel in the action.” (Italics added.)
There can be no explanation of the last sentence of section 412.21(a)(2) except that the Legislature specifically intended that spouses have the power to use community property to pay attorney fees in dissolution actions. The Legislature, though not mandating that community property be used to pay attorney fees, clearly contemplated the practice and approved it. If the Legislature had been of the view that section 5127 precluded resort to community property to pay attorney fees, there would have been no reason to include the statement in question.
Moreover, section 412.21(a)(2) does not limit the community property that may be used to pay attorney fees to readily accessible or “liquid” community *52personal property, as the majority suggests. Rather, the first sentence of the section expressly refers to both real and personal community property; the second sentence refers generally to community property, and does not state that only one type of community property may be used to pay attorney fees. The obvious conclusion is that when the Legislature in the last sentence of section 412.21(a)(2) used the phrase “community property” without limitation, it meant both types of community property. Because community real property is ordinarily not “liquid,” the only practical means to use it to pay attorney fees is through an encumbrance.
It is the duty of this court to harmonize statutes on the same subject (e.g., Dyna-Med, Inc. v. Fair Employment & Housing Com., supra, 43 Cal.3d at p. 1387; Long Beach Police Officers Assn. v. City of Long Beach (1988) 46 Cal.3d 736, 746 [250 Cal.Rptr. 869, 759 P.2d 504]), giving effect to all parts of all statutes if possible (e.g., Select Base Materials v. Board of Equal., supra, 51 Cal.2d at p. 645). In applying that duty to the issue presented here, this court must give preference to a reasonable construction of section 5127 that harmonizes it with section 412.21(a).
Read literally and without regard to its underlying purpose, section 5127 appears to forbid what section 412.21(a) implicitly but unmistakably approves: a spouse’s unilateral encumbrance of community real property to secure reasonable attorney fees, and thereby to obtain legal representation, in a marital dissolution action. Because section 5127 relates to conveyances and encumbrances of community real property in general, while section 412.21(a) refers specifically to the use of community property to retain counsel in marital dissolution proceedings, the two provisions can be harmonized as follows: Under sections 5127 and 412.21(a), the parties to a dissolution action may encumber community real property to the extent of their interests to secure reasonable attorney fees in a dissolution action, but they may not otherwise independently convey or encumber community real property after separation; and the parties to a continuing marriage may not do so at all without the written consent of the other spouse.2
Harmonizing the two provisions in this manner serves the purpose of section 412.21(a) by allowing what the Legislature expressly intended to permit. And, as I will show, it comports fully with the legislative purpose *53underlying section 5127, which is to protect one spouse from fraudulent or improvident expenditures by the other spouse during the continued existence of the marriage.
The predecessor to section 5127 was former Civil Code section 172a, enacted in 1917; it provided that “[t]he husband has the management and control of the community real property, but the wife must join with him in executing any instrument by which such community real property or any interest therein is leased for a longer period than one year, or is sold, conveyed or encumbered; . . .” (Stats. 1917, ch. 583, § 2, pp. 829-830.)
This court discussed the purpose of former Civil Code section 172a in 1926, in connection with a parallel amendment to former Civil Code section 172, concerning alienation of community personal property. We said: “All that the legislature by these amendments did do or attempt to do was to cast about the interest of the wife in both the real and personal property of the community during the continued existence of the marriage relation added safeguards and protection against the fraudulent or inconsiderate acts of the husband . . . .” (Stewart v. Stewart (1926) 199 Cal. 318, 340 [249 P. 197], italics added; accord, e.g., Strong v. Strong (1943) 22 Cal.2d 540, 544 [140 P.2d 386]; Morghee v. Rouse (1964) 224 Cal.App.2d 745, 748 [37 Cal.Rptr. 112].)
In the years since we first construed former Civil Code section 172a, community property law has evolved. In 1927, the Legislature declared ownership of community property by both spouses to be “present, existing and equal.” (Stats. 1927, ch. 265, § 1, p. 484.) In 1973, the Legislature gave “either spouse” management and control of community real and personal property. (Stats. 1973, ch. 987, § 15, p. 1901.)
The restriction that section 5127 imposes is the same as that imposed by its predecessor, former Civil Code section 172a. The only difference is that section 5127 imposes the restriction equally on both spouses rather than on the husband alone. There has been no change in the essential purpose of section 5127, namely, to protect one spouse from the other’s fraudulent or improvident expenditures of community property “during the continued existence of the marriage relation . . . .” (Stewart v. Stewart, supra, 199 Cal. at p. 340.)
Legally, a marriage continues until the entry of a judgment of dissolution, and the parties have a continuing duty of good faith toward each other. (Civ. Code, §§ 4501, 5125, subd. (e).) Realistically, however, when the parties to a marriage have separated and commenced a dissolution lawsuit, their relations have fundamentally changed. (See In re Marriage of Connolly *54(1979) 23 Cal.3d 590, 600 [153 Cal.Rptr. 423, 591 P.2d 911].) They are living apart, and they are legal adversaries. In such circumstances, the protective rationale of section 5127 is not frustrated by allowing spouses to encumber community real property to secure attorney fees. The interests of the parties are protected by the efforts of counsel and the equitable powers of the court.
Giving full effect to the legislative intent reflected in section 412.21(a) does not at all impair the purpose of section 5127, which is to protect nonconsenting spouses in ongoing marriages from fraudulent or ill-advised transfers of community real property. Accordingly, I would hold that under sections 412.21(a) and 5127 the parties to a dissolution action may encumber community real property to the extent of their interests to secure reasonable attorney fees in the dissolution action,3
In this case, Wife unilaterally encumbered her undivided one-half interest in community real property to secure attorney fees in her dissolution action against Husband. Since then, the parties have apparently decided to remain married, and Husband now contends that the encumbrance must be held entirely void. In accordance with the analysis set forth above, I would hold the encumbrance valid as to Wife’s interest.
The security interest in Wife’s share of the property was given in 1986, three years before the Legislature enacted section 412.21. But the purpose of section 5127, which was set forth in our cases long before the enactment of section 412.21, is to protect spouses in continuing marriages from the *55fraudulent and improvident acts of their marital partners, not to prevent parties to a dissolution lawsuit from protecting their interests. The Legislature’s enactment of section 412.21(a) does not alter the meaning of section 5127, but illuminates the Legislature’s understanding of the statutory scheme it created as not precluding resort to community real property to secure attorney fees in a dissolution action. (See In re Marriage of Bouquet (1976) 16 Cal.3d 583, 590 [128 Cal.Rptr. 427, 546 P.2d 1371] [it is proper to look to a subsequent expression of legislative intent in construing a prior statute].) Irrespective of the date of enactment of section 412.21, it would not serve the purpose of section 5127 to interpret section 5127 to preclude encumbrances given to secure attorney fees after the parties have separated. Therefore, section 5127 should not be applied in this case to bar the encumbrance. (See 2A Sutherland, Statutory Construction (4th ed. 1984) § 54.04, p. 570 [“where there is doubt about how inclusively a statute should be applied, it will be construed to apply only so far as is needed to remedy the perceived mischief”].)
For these reasons, I would reverse the judgment of the Court of Appeal.
Under the Rules of Professional Conduct and the decisions of this court, an attorney may ensure payment of fees by acquiring a promissory note secured by a deed of trust on the client’s real property so long as (1) the attorney fully discloses the terms of the transaction to the client in an understandable fashion, (2) the terms are fair and reasonable, and (3) the client consents in writing after having had an opportunity to consult independent counsel. (Rules Prof. Condüct, rule 3-300; Hawk v. State Bar (1988) 45 Cal.3d 589, 593 [247 Cal.Rptr. 599, 754 P.2d 1096].)
Of course, even when an attorney holds a promissory note secured by a deed of trust, the attorney is not necessarily entitled to fees in any given amount. In this context, as well as others, clients are protected from overreaching by rule 4-200 of the Rules of Professional Conduct, the general law of contracts (see Civ. Code, §§ 1670.5, 1770, subd. (s)), and the inherent powers of the courts to review attorney-fee contracts to prevent unfairness (see Roa v. Lodi Medical Group, Inc. (1985) 37 Cal.3d 920, 933 [211 Cal.Rptr. 77, 695 P.2d 164]).
Husband suggests that the problems of economically weaker spouses in obtaining adequate representation are solved by Civil Code section 5125.1, subdivision (e), which empowers the trial court to dispense with the requirement of both spouses’ consent to encumber or dispose of community real property when the “proposed transaction is in the best interest of the community” and consent is “arbitrarily refused.” He is mistaken. For the reasons given by the majority, “[i]n most cases, . . . [Civil Code] section 5125.1, subdivision (e) may prove to be an illusory remedy for the economically weak spouse.” (Maj. opn., ante, at p. 41.)
The majority contends that section 412.21(a) does not “create an exception” to section 5127, or impliedly repeal that section. These contentions miss the dissent’s point. The dissent has shown that when section 5127 is interpreted in light of the legislative purpose to protect spouses in continuing marriages, and construed with a view toward harmonizing it with section 412.21(a), the conclusion is inescapable that the Legislature did not intend to bar spouses from using their interests in community real property to secure attorney fees in a dissolution action. No discussion of exceptions or implied repeal is necessary to resolve this issue.
The majority claims that harm could result under the dissent’s approach if an economically stronger spouse encumbered his or her interest in the community residence to secure attorney fees, the spouse defaulted, the mortgage lender foreclosed, and the mortgage lender then brought an action for partition against the other spouse. (Maj. opn., ante, at pp. 44-45, fn. 15.) Although harm according to this scenario might occur in isolated cases, this possibility should be contrasted with the certainty that, under the majority’s approach, injustice and hardship for economically weaker spouses will result in an entire class of cases when the spouses’ inability to use their property to secure attorney fees deprives them of effective legal representation.
Finally, the majority contends that under the dissent’s approach the trial court’s role might be made more difficult in some cases. Although the trial court’s duty of equal division of community assets under Civil Code section 4800 might be made more complicated after an encumbrance, this factor is no reason to deprive spouses of their rights.