
56 Cal.2d 583 (1961)
ROBERT LUCAS et al., Plaintiffs and Appellants,
v.
L. S. HAMM, Defendant and Respondent.
S. F. No. 20269. 
Supreme Court of California. In Bank.  
Sept. 5, 1961.
 Reginald G. Hearn for Plaintiffs and Appellants.
 Philip H. Angell, Scott Elder, Robert M. Adams, Jr., Angell, Adams, Gochnauer & Elder and B. E. Kragen for Defendant and Respondent.
 GIBSON, C. J.
 Plaintiffs, who are some of the beneficiaries under the will of Eugene H. Emmick, deceased, brought this action for damages against defendant L. S. Hamm, an attorney at law who had been engaged by the testator to prepare the will. They have appealed from a judgment of dismissal entered after an order sustaining a general demurrer to the second amended complaint without leave to amend.
 The allegations of the first and second causes of action are summarized as follows: Defendant agreed with the testator, for a consideration, to prepare a will and codicils thereto for him by which plaintiffs were to be designated as beneficiaries of a trust provided for by paragraph Eighth of the will and were to receive 15 per cent of the residue as specified in that paragraph. Defendant, in violation of instructions and in breach of his contract, negligently prepared testamentary instruments containing phraseology that was invalid by virtue of section 715.2 and former sections 715.1 and 716 of the Civil Code relating to restraints on alienation and the rule against perpetuities.  [fn. 1]paragraph Eighth of these instruments *587 "transmitted" the residual estate in trust and provided that the "trust shall cease and terminate at 12 o'clock noon on a day five years after the date upon which the order distributing the trust property to the trustee is made by the Court having jurisdiction over the probation of this will." After the death of the testator the instruments were admitted to probate. Subsequently defendant, as draftsman of the instruments and as counsel of record for the executors, advised plaintiffs in writing that the residual trust provision was invalid and that plaintiffs would be deprived of the entire amount to which they would have been entitled if the provision had been valid unless they made a settlement with the blood relatives of the testator under which plaintiffs would receive a lesser amount than that provided for them by the testator. As the direct and proximate result of the negligence of defendant and his breach of contract in preparing the testamentary instruments and the written advice referred to above, plaintiffs were compelled to enter into a settlement under which they received a share of the estate amounting to $75,000 less than the sum which they would have received pursuant to testamentary instruments drafted in accordance with the directions of the testator.
 (The third cause of action will be discussed separately because it concerns matters not involved in the first two counts.) *588
 It was held in Buckley v. Gray, 110 Cal. 339 [42 P. 900, 52 Am.St.Rep. 88, 31 L.R.A. 862], that an attorney who made a mistake in drafting a will was not liable for negligence or breach of contract to a person named in the will who was deprived of benefits as a result of the error. The court stated that an attorney is liable to his client alone with respect to actions based on negligence in the conduct of his professional duties, and it was reasoned that there could be no recovery for mere negligence where there was no privity by contract or otherwise between the defendant and the person injured. (110 Cal. at pp. 342-343.) The court further concluded that there could be no recovery on the theory of a contract for the benefit of a third person, because the contract with the attorney was not expressly for the plaintiff's benefit and the testatrix only remotely intended the plaintiff to be benefited as a result of the contract. (110 Cal. at pp. 346-347.) For the reasons hereinafter stated the case is overruled.
 [1] The reasoning underlying the denial of tort liability in the Buckley case, i.e., the stringent privity test, was rejected in Biakanja v. Irving, 49 Cal.2d 647, 648-650 [320 P.2d 16, 65 A.L.R.2d 1358], where we held that a notary public who, although not authorized to practice law, prepared a will but negligently failed to direct proper attestation was liable in tort to an intended beneficiary who was damaged because of the invalidity of the instrument. It was pointed out that since 1895, when Buckley was decided, the rule that in the absence of privity there was no liability for negligence committed in the performance of a contract had been greatly liberalized. (49 Cal.2d at p. 649.) In restating the rule it was said that the determination whether in a specific case the defendant will be held liable to a third person not in privity is a matter of policy and involves the balancing of various factors, among which are the extent to which the transaction was intended to affect the plaintiff, the foreseeability of harm to him, the degree of certainty that the plaintiff suffered injury, the closeness of the connection between the defendant's conduct and the injury, and the policy of preventing future harm. (49 Cal.2d at p. 650.) The same general principle must be applied in determining whether a beneficiary is entitled to bring an action for negligence in the drafting of a will when the instrument is drafted by an attorney rather than by a person not authorized to practice law.
 [2] Many of the factors which led to the conclusion that the notary public involved in Biakanja was liable are equally *589 applicable here. As in Biakanja, one of the main purposes which the transaction between defendant and the testator intended to accomplish was to provide for the transfer of property to plaintiffs; the damage to plaintiffs in the event of invalidity of the bequest was clearly foreseeable; it became certain, upon the death of the testator without change of the will, that plaintiffs would have received the intended benefits but for the asserted negligence of defendant; and if persons such as plaintiffs are not permitted to recover for the loss resulting from negligence of the draftsman, no one would be able to do so and the policy of preventing future harm would be impaired.
 [3] Since defendant was authorized to practice the profession of an attorney, we must consider an additional factor not present in Biakanja, namely, whether the recognition of liability to beneficiaries of wills negligently drawn by attorneys would impose an undue burden on the profession. Although in some situations liability could be large and unpredictable in amount, this is also true of an attorney's liability to his client. We are of the view that the extension of his liability to beneficiaries injured by a negligently drawn will does not place an undue burden on the profession, particularly when we take into consideration that a contrary conclusion would cause the innocent beneficiary to bear the loss. The fact that the notary public involved in Biakanja was guilty of unauthorized practice of the law was only a minor factor in determining that he was liable, and the absence of the factor in the present case does not justify reaching a different result.
 It follows that the lack of privity between plaintiffs and defendant does not preclude plaintiffs from maintaining an action in tort against defendant.
 [4a] Neither do we agree with the holding in Buckley that beneficiaries damaged by an error in the drafting of a will cannot recover from the draftsman on the theory that they are third-party beneficiaries of the contract between him and the testator.  [fn. 2] Obviously the main purpose of a contract *590 for the drafting of a will is to accomplish the future transfer of the estate of the testator to the beneficiaries named in the will, and therefore it seems improper to hold, as was done in Buckley, that the testator intended only "remotely" to benefit those persons. [5] It is true that under a contract for the benefit of a third person performance is usually to be rendered directly to the beneficiary, but this is not necessarily the case. (See Rest., Contracts,  133, comment d; 2 Williston on Contracts (3d ed. 1959) 829.) For example, where a life insurance policy lapsed because a bank failed to perform its agreement to pay the premiums out of the insured's bank account, it was held that after the insured's death the beneficiaries could recover against the bank as third-party beneficiaries. (Walker Bank & Trust Co. v. First Security Corp., 9 Utah 2d 215 [341 P.2d 944, 945 et seq.].)persons who had agreed to procure liability insurance for the protection of the promisees but did not do so were also held liable to injured persons who would have been covered by the insurance, the courts stating that all persons who might be injured were third-party beneficiaries of the contracts to procure insurance. (Johnson v. Holmes Tuttle Lincoln-Merc., 160 Cal.App.2d 290, 296 et seq. [325 P.2d 193]; James Stewart & Co. v. Law, 149 Tex. 392 [233 S.W.2d 558, 561-562, 22 A.L.R.2d 639].) [4b] Since, in a situation like those presented here and in the Buckley case, the main purpose of the testator in making his agreement with the attorney is to benefit the persons named in his will and this intent can be effectuated, in the event of a breach by the attorney, only by giving the beneficiaries a right of action, we should recognize, as a matter of policy, that they are entitled to recover as third-party beneficiaries. (See 2 Williston on Contracts (3d ed. 1959) pp. 843-844; 4 Corbin on Contracts (1951) pp. 8, 20.)
 [6] Section 1559 of the Civil Code, which provides for enforcement by a third person of a contract made "expressly" for his benefit, does not preclude this result. The effect of the section is to exclude enforcement by persons who are only incidentally or remotely benefited. (See Hartman Ranch Co. v. Associated Oil Co., 10 Cal.2d 232, 244 [73 P.2d 1163]; cf. 4 Corbin on Contracts (1951) pp. 23-24.) As we have seen, a contract for the drafting of a will unmistakably shows the intent of the testator to benefit the persons to be named in the will, and the attorney must necessarily understand this.
 [7] Defendant relies on language in Smith v. Anglo- California *591 Trust Co., 205 Cal. 496, 502 [271 P. 898], and Fruitvale Canning Co. v. Cotton, 115 Cal.App.2d 622, 625 [252 P.2d 953], that to permit a third person to bring an action on a contract there must be "an intent clearly manifested by the promisor" to secure some benefit to the third person. This language, which was not necessary to the decision in either of the cases, is unfortunate. Insofar as intent to benefit a third person is important in determining his right to bring an action under a contract, it is sufficient that the promisor must have understood that the promisee had such intent. (Cf. Rest., Contracts,  133, subds. 1(a) and 1(b); 4 Corbin on Contracts (1951) pp. 16-18; 2 Williston on Contracts (3d ed. 1959) pp. 836-839.) No specific manifestation by the promisor of an intent to benefit the third person is required. The language relied on by defendant is disapproved to the extent that it is inconsistent with these views.
 [8] We conclude that intended beneficiaries of a will who lose their testamentary rights because of failure of the attorney who drew the will to properly fulfill his obligations under his contract with the testator may recover as third-party beneficiaries.
 However, an attorney is not liable either to his client or to a beneficiary under a will for errors of the kind alleged in the first and second causes of action.
 [9] The general rule with respect to the liability of an attorney for failure to properly perform his duties to his client is that the attorney, by accepting employment to give legal advice or to render other legal services, impliedly agrees to use such skill, prudence, and diligence as lawyers of ordinary skill and capacity commonly possess and exercise in the performance of the tasks which they undertake. (Estate of Kruger, 130 Cal. 621, 626 [63 P. 31]; Moser v. Western Harness Racing Assn., 89 Cal.App.2d 1, 7 [200 P.2d 7]; Armstrong v. Adams, 102 Cal.App. 677, 684 [283 P. 871]; see Wade, The Attorney's Liability for Negligence (1959) 12 Vanderbilt L.Rev. 755, 762-765; 5 Am.Jur. 336.) [10] The attorney is not liable for every mistake he may make in his practice; he is not, in the absence of an express agreement, an insurer of the soundness of his opinions or of the validity of an instrument that he is engaged to draft; and he is not liable for being in error as to a question of law on which reasonable doubt may be entertained by well-informed lawyers. (See Lally v. Kuster, 177 Cal. 783, 786 [171 P. 961]; National Savings Bank v. Ward, 100 U.S. 195, 198 [25 L.Ed. 621]; *592 5 Am.Jur. 335; 7 C.J.S. 980.) These principles are equally applicable whether the plaintiff's claim is based on tort or breach of contract.
 [11] The complaint, as we have seen, alleges that defendant drafted the will in such a manner that the trust was invalid because it violated the rules relating to perpetuities and restraints on alienation. These closely akin subjects have long perplexed the courts and the bar. Professor Gray, a leading authority in the field, stated: "There is something in the subject which seems to facilitate error.perhaps it is because the mode of reasoning is unlike that with which lawyers are most familiar. ... A long list might be formed of the demonstrable blunders with regard to its questions made by eminent men, blunders which they themselves have been sometimes the first to acknowledge; and there are few lawyers of any practice in drawing wills and settlements who have not at some time either fallen into the net which the Rule spreads for the unwary, or at least shuddered to think how narrowly they have escaped it." (Gray, The Rule Against Perpetuities (4th ed. 1942) p. xi; see also Leach, Perpetuities Legislation (1954) 67 Harv.L.Rev. 1349 [describing the rule as a "technicality-ridden legal nightmare" and a "dangerous instrumentality in the hands of most members of the bar"].) Of the California law on perpetuities and restraints it has been said that few, if any, areas of the law have been fraught with more confusion or concealed more traps for the unwary draftsman; that members of the bar, probate courts, and title insurance companies make errors in these matters; that the code provisions adopted in 1872 created a situation worse than if the matter had been left to the common law, and that the legislation adopted in 1951 (under which the will involved here was drawn), despite the best of intentions, added further complexities. (See 38 Cal.Jur.2d 443; Coil, Perpetuities and Restraints; A Needed Reform (1955) 30 State Bar J. 87, 88-90.)
 In view of the state of the law relating to perpetuities and restraints on alienation and the nature of the error, if any, assertedly made by defendant in preparing the instrument, it would not be proper to hold that defendant failed to use such skill, prudence, and diligence as lawyers of ordinary skill and capacity commonly exercise. The provision of the will quoted in the complaint, namely, that the trust was to terminate five years after the order of the probate court distributing the property to the trustee, could cause the trust to be *593 invalid only because of the remote possibility that the order of distribution would be delayed for a period longer than a life in being at the creation of the interest plus 16 years (the 21-year statutory period less the five years specified in the will). Although it has been held that a possibility of this type could result in invalidity of a bequest (Estate of Johnston, 47 Cal.2d 265, 269-270 [303 P.2d 1]; Estate of Campbell, 28 Cal.App.2d 102, 103 et seq. [82 P.2d 22]), the possible occurrence of such a delay was so remote and unlikely that an attorney of ordinary skill acting under the same circumstances might well have "fallen into the net which the Rule spreads for the unwary" and failed to recognize the danger. We need not decide whether the trust provision of the will was actually invalid or whether, as defendant asserts, the complaint fails to allege facts necessary to enable such a determination,  [fn. 3] because we have concluded that in any event an error of the type relied on by plaintiffs does not show negligence or breach of contract on the part of defendant. It is apparent that plaintiffs have not stated and cannot state causes of action with respect to the first two counts, and the trial court did not abuse its discretion in denying leave to amend as to these counts.
 [12] The third cause of action contains additional allegations as follows: After admission of the will and codicils to probate, Harold Houghton Emmick, Walton Russell Emmick, Clelta Inez Spelman, and Retha Newell, hereinafter called the contestants, instituted a will contest. The executors, defendant, and the contestants tentatively reached a settlement agreement, subject to court approval, under which $10,000 would be paid to the contestants from the assets of the estate in return for which each contestant would sign an "appropriate release." Defendant was negligent in the performance of his duties in that he caused to be executed on behalf of the estate and those interested therein, including plaintiffs, releases which did not preclude the contestants from a subsequent attack upon the validity of the testamentary instruments. After complete execution of the releases and their transmittal to escrow but before approval of the compromise *594 by the court, defendant was advised by competent counsel that the residual clause of the will and codicils was invalid as a violation of the rule against perpetuities and that as a consequence the phraseology of the releases was inadequate to protect the estate and persons interested therein, and defendant was requested by competent counsel to modify the releases and insert appropriate language suggested by counsel under which the contestants would release the estate and persons interested in it from any claims of whatsoever kind or nature. Defendant refused to do so and also refused to call the court's attention to the recommendations. As a consequence of the failure to direct the matter to the attention of the court, the order approving the compromise was made on the assumption that the releases would give adequate protection. The sum of $10,000 was paid to the contestants from the assets of the estate, and the releases were filed in the proceedings. Subsequently the contestants joined in a legal attack upon the validity of the residual clause of the will and codicils and by virtue of the invalidity of the clause participated in the settlement referred to above concerning paragraph Eighth of the will. If the releases had been prepared in accord with good legal practice they would have precluded such participation, with the result that plaintiffs would have received an additional sum of $15,000 from the estate.
 This cause of action, unlike the first two, does not concern defendant's conduct as attorney for the testator, but, rather, asserted negligence by him when acting as attorney for the executors with respect to the execution of releases in the settlement of a will contest based on lack of testamentary capacity. It is undisputed that the releases were adequate to preclude any further litigation of that contest, but plaintiffs assert that defendant had a duty to obtain releases which, in addition, would waive all other claims of the contestants against the estate and prevent them from subsequently attacking the validity of the trust provisions.
 There are no allegations that the contestants, either at the time of the negotiations for the settlement or at the time of the signing of the releases, were willing to waive their rights to make other attacks upon the will after the settlement of that contest. In the absence of additional allegations we must assume that the agreed sum of $10,000 was intended solely for the settlement of the contest and the ground on which it was based, i.e., lack of testamentary capacity, and it would ordinarily be expected that the contestants would have demanded *595 an additional sum for a more extensive waiver terminating their rights to attack the validity of the various provisions of the will. The written releases, of course, were required to conform to the settlement agreement. Under these circumstances it could well be argued that the attorneys for the contestants would have been derelict in their duty to their clients if they had approved broader releases. At most, under the allegations, defendant had a duty to request that the contestants sign broader releases, but there is no allegation that he failed to ask them to do so. The third count does not state a cause of action for negligence.
 Although defendant pointed out in both the trial court and this court that there is no allegation that he could have secured releases different from the ones given, plaintiffs make no claim that they can amend their complaint so as to cure the deficiency, and we cannot properly hold that the trial court abused its discretion in denying leave to amend.
 The judgment is affirmed.
 Traynor, J., Schauer, J., McComb, J., Peters, J., White, J., and Dooling, J., concurred.
 Section 715.2 reads as follows: "No interest in real or personal property shall be good unless it must vest, if at all, not later than 21 years after some life in being at the creation of the interest and any period of gestation involved in the situation to which the limitation applies. The lives selected to govern the time of vesting must not be so numerous or so situated that evidence of their deaths is likely to be unreasonably difficult to obtain. It is intended by the enactment of this section to make effective in this State the American common-law rule against perpetuities."
 Former section 716, as it read at the times involved here, provided: "Every future interest is void in its creation which, by any possibility, may suspend the absolute power of alienation for a longer period than is prescribed in this chapter. Such power of alienation is suspended when there are no persons in being by whom an absolute interest in possession can be conveyed. The period of time during which an interest is destructible pursuant to the uncontrolled volition and for the exclusive personal benefit of the person having such a power of destruction is not to be included in determining the existence of a suspension of the absolute power of alienation or the permissible period for the vesting of an interest within the rule against perpetuities."
NOTES
[fn. 1]  1. Former section 715.1 of the Civil Code, as it read at the times involved here, provided: "The absolute power of alienation cannot be suspended, by any limitation or condition whatever, for a period longer than 21 years after some life in being at the creation of the interest and any period of gestation involved in the situation to which the limitation applies. The lives selected to govern the time of suspension must not be so numerous or so situated that evidence of their deaths is likely to be unreasonably difficult to obtain."
[fn. 2]  2. It has been recognized in other jurisdictions that the client may recover in a contract action for failure of the attorney to carry out his agreement. (See 5 Am.Jur. 331; 49 A.L.R.2d 1216, 1219-1221; Prosser, Selected Topics on the Law of Torts (1954) pp. 438, 442.) This is in accord with the general rule stated in Comunale v. Traders & General Ins. Co., 50 Cal.2d 654, 663 [328 P.2d 198], that where a case sounds in both tort and contract, the plaintiff will ordinarily have freedom of election between the two actions.
[fn. 3]  3. Defendant asserts that a provision of a will like the one quoted in the complaint could not cause a trust to be invalid unless it also appeared that there were contingent interests which could not vest within the statutory time or that the trust could not be terminated by the beneficiaries acting together within the statutory period. (See Estate of Phelps, 182 Cal. 752, 759-760 [190 P. 17]; Estate of Heberle, 155 Cal. 723, 726-727 [102 P. 935]; Rest. 2d Trusts,  337.)
