Rugg, C.J.
This is an action of contract. The declaration alleges that the plaintiffs issued a letter of credit to The J. F. Mosser Co. Inc., engaged in trade in Argentina, in the sum of $50,000; that that company contemporaneously executed an agreement with the plaintiffs to furnish to them funds to meet all drafts drawn by it against the letter of credit one day before maturity; that thereafter, fór a valu- ' able consideration, the Equitable Trust Company and the Mosser Company executed and delivered to the plaintiffs a written guarantee of the complete performance by the Mosser Company of its agreement with the plaintiffs; that the Mosser Company failed in the performance of its agreement by not providing funds to meet certain drafts drawn by it against the letter of credit; wherefore the defendants owe the plaintiffs stated amounts. The Mosser Company did not appear and has been defaulted. The Equitable Trust Company alone makes defence. Its answer is a general denial, payment, and discharge of its obligations, if any be proved, by conduct of the plaintiffs.
The case was tried to a jury. At the conclusion of the evidence, a verdict was directed for the defendant and, at the request of the parties, the case was reported upon a stipulation that, if upon the admissible evidence the plaintiffs are entitled to recover, judgment may be entered for them in such sum as this court may determine.
*593The material evidence was that the letter of credit was issued in the regular course of the business of the plaintiffs as bankers, whereby they authorized the Mosser Company to draw upon them at ninety days’ sight for any sum or sums not exceeding $50,000 for the invoice cost of quebracho extract, bills of lading to order of plaintiffs to be attached to draft, duplicate invoice and consular invoice with copy of bill of lading to be sent directly to plaintiffs, with other stated conditions. On the back of a duplicate copy of the letter of credit was an agreement directed to the plaintiffs and signed by the Mosser Company, wherein the latter agreed to furnish them on the day before the maturity of any acceptance under the letter of credit funds of the same amount. There also was recognition and admission of the plaintiffs’ ownership of all goods and the proceeds thereof for which they might come under engagement by virtue of the letter of credit and possessiop of all bills of lading for and insurance on such goods, with power to sell. In the event of the plaintiffs entrusting such goods to the Mossér Company for sale or otherwise, it consented that they might repossess themselves of the same or any proceeds thereof, to be applied on its indebtedness to the plaintiffs, and, in case of insufficiency to meet same, to pay the amount forthwith, together with other undertakings not pertinent to the present issue. ■ This agreement throughout’ was subsidiary and ancillary to the furnishing of funds to meet drafts drawn against the letter of credit. It had to do also with the relations of the parties to the goods which it was the obvious purpose of the letter of credit to enable the Mosser Company to import. Physically attached to this agreement was a guaranty reciting the consideration of $1.00 in hand paid by the plaintiffs, the receipt of which was acknowledged, whereby the Equitable Trust Company did “ guarantee, promise,' and agree, to and with ” the plaintiffs that the Mosser Company would' perform its agreement with the plaintiffs. This guaranty was signed in the name of the trust company by one Pratt, its treasurer. The present action is brought on this guaranty.
The defendant has argued that Pratt had no authority to *594execute the guaranty in its name. It is doubtful whether this point is open under an answer in which there is no denial of the signature or of the authority of the officer affixing it. G. L. c. 231, § 29. Kendall v. Carland, 5 Cush. 74. Without discussing that point, there was evidence of the authority of Pratt. There was testimony that he had signed other instruments of like nature in the name of the trust company with the knowledge of its president and other officers. That testimony was competent as tending to show an established course of business. The by-laws of the defendant were not inconsistent with such authority. Under it. L. c. 116, §§ 7, 8, now G. L. c. 172, §§ 12,13, it was within the power of the trust company to authorize the treasurer to execute contracts in its name. Testimony, to the effect that the president of the defendant, in the early negotiations with the plaintiffs concerning the liability on which the present action is founded, made no question of the authority of Pratt and did not disavow it, was competent on this point. It had also stime tendency to show ratification of his act even if originally without authority. Boice-Perrine Co. v. Kelley, 243 Mass. 327, 331, and cases there collected. Conferring of such authority was within the power of the defendant. The whole matter was a fact to be determined by the jury. Produce Exchange Trust Co. v. Bieberbach, 176 Mass. 577. Beacon Trust Ca. v. Souther, 183 Mass. 413. Forgeron v. Corey Hill Garage, Inc. ante, 163, and cases there collected. Merchants’ Bank v. State Bank, 10 Wall. 604. The case at bar is distinguishable from Sears v. Corr Manuf. Co. 242 Mass. 395, and similar decisions.
The delivery of the documents of title of the goods imported upon the strength of the letter of credit by the plaintiffs to the Mosser Company and the taking in place thereof of trust receipts did not operate as a complete or pro tanto release of the obligation of the guarantor of the letter of credit. The principle that surrender by a creditor of security for its debt without the consent and to the injury of the surety releases the surety to that extent has no application to the facts here disclosed. The relation between the plaintiffs and the Mosser Company was that of banker and importer, *595the banker furnishing the letter of credit whereby the purchase of the imported goods may be accomplished and the importer taking all the risks and being entitled to all the profits of the transaction. The delivery of physical possession and the documents of title by the banker, who is the owner of the imported goods, to the importer in return for trust receipts is the customary course of the business. That is manifest from numerous decisions, where the nature of the relation between the banker and importer and of trust receipts has been explained. Moors v. Wyman, 146 Mass. 60. Peoples National Bank v. Mulholland, 224 Mass. 448, 451; S. C. 228 Mass. 152, 155, and cases collected. Brown v. Green & Hickey Leather Co. 244 Mass. 168. T. D. Downing Co. v. Shawmut Corp. of Boston, 245 Mass. 106. There is nothing on this record to indicate that the guaranty was not signed by the defendant with reference to this well understood course of conduct between the banker and the merchant. The agreement of the Mosser Company, which was guaranteed by the defendant, contains express reference to the event that the plaintiffs might entrust the imports to the Mosser Company for sale or otherwise. This reference plainly incorporates into the guaranty that method of transacting the business. In such circumstances delivery of the documents of title by the plaintiffs to the Mosser Company in return for its trust receipts was not a surrender of security contemplated by the guaranty. The title remained in the plaintiffs under the trust receipts. It seems manifest from this record that the guaranty was made with reference to that course of trade and that the defendant cannot complain of it.
The defendant urges that the contract of guaranty was ultra vires the trust company. As matter of pleading, that defence ought to have been set up in the answer. This point seems not to have been expressly decided hitherto by this court, although mentioned incidentally. It is the necessary result of recognized general principles. Contracts of a corporation commonly are presumed to be within its lawful power until the contrary is made to appear. Illegality of a contract, unless of such nature as to shock the *596conscience or to be inherently wrong, or unless patent upon the plaintiff’s own case, usually must be pleaded. G. L. c. 231, § 28. Granger v. Ilsley, 2 Gray, 521. Suit v. Woodhall, 116 Mass. 547. Nashua & Lowell Railroad v. Boston & Lowell Railroad, 157 Mass. 268, 272. Worcester v. Worcester & Holden Street Railway, 194 Mass. 228. O’Brien v. Shea, 208 Mass. 528, 534-536. Whittingslow v. Thomas, 237 Mass. 103. Coughlin v. Royal Indemnity Co. 244 Mass. 317. Express Co. v. Railroad Co. 99 U. S. 191, 199. Railway Co. v. McCarthy, 96 U. S. 258,267. Providence Engineering Corp. v. Downey Shipbuilding Corp. 294 Fed. Rep. 641, 659. Jacobs v. Monaton Realty Investment Corp. 212 N. Y. 48, 56. Knapp v. Tidewater Coal Co. 85 Conn. 147.
The defence of ultra vires is not open merely because under the terms of the report based upon the stipulation of the parties it is provided that “ if upon the admissible evidence the plaintiffs are entitled to recover, then judgment is to be entered for them.” As matter of construction, this means judgment may be entered for plaintiffs if they are entitled to recover upon the evidence admissible under the pleadings. Park & Pollard Co. v. Agricultural Ins. Co. 238 Mass. 187, 195. Foss v. Lowell Five Cents Savings Bank, 111 Mass. 285, 287. Elliott v. Worcester Trust Co. 189 Mass. 542, 544. It is not the equivalent of a submission upon a case stated where all questions of pleading ordinarily are waived. Brettun v. Fox, 100 Mass. 234. Elliott v. Worcester Trust Co. 189 Mass. 542, 544. Ward v. Great Atlantic & Pacific Tea Co. 231 Mass. 90, 92. Bartlett v. Tufts, 241 Mass. 96, 99.
The case, however, seems to have been fully tried on this point. Evidence presented by the plaintiffs, calculated to overcome the force of ultra vires as a defence, was admitted subject to the exception of the defendant. That evidence was to the effect that it was the custom among trust companies to guarantee letters of credit. Its relevancy upon any other issue is not perceived. In behalf of the plaintiffs, the argument at the bar in support of the admissibility of that evidence was that it bore upon the incidental or implied powers of a trust company and in general supported the *597contention that the express powers granted by the statute to the defendant were broad enough, in the light of such prevailing practices among trust companies, to render legal and binding the guaranty of the defendant on which this action rests. That argument is in substance simply that such evidence tends to show that a contract of that nature is not ultra vires. When a party has tried his case on the theory that evidence is competent, but which is not competent merely because of an omission in pleading, and he has not directed the attention of the trial court to that omission, and his evidence has been received and considered, he ought not ordinarily to be allowed in this court to rely upon that omission in pleading. Ridenour v. H. C. Dexter Chair Co. 209 Mass. 70, 78, and cases there collected. Walker v. Russell, 240 Mass. 386. Ryder v, Ellis, 241 Mass. 50, 56. Aikey v. Gardner, 243 Mass. 77, 85. This is especially true of the defence of ultra vires which, so far as concerns the present case, raises a pure question of law almost, if not wholly, dissociated from evidence. The answer might easily have been amended if its inadequacy in this particular had been mentioned at the trial. The case at bar is distinguishable in this particular from the large class of cases, illustrated by Granara v. Jacobs, 212 Mass. 271, where rulings have been made presumptively on the pleadings, and from the other large class of cases illustrated by Parrot v. Mexican Central Railway, 207 Mass. 184, where a party has confined his trial conduct strictly within the pleadings and is permitted to avail himself of whatever legal rights arise therefrom. Proctor v. Dillon, 235 Mass. 538, 540. United States v. Nixon, 235 U. S. 231, 236. The ruling of the court below must be presumed to have been rested upon all the evidence which was admitted, including that introduced by the plaintiffs on the subject of ultra vires. It was right upon that ground and upon no other.
In view of the course of the trial, the plaintiffs are not in a position now "to rely upon the omission by the defendant to set up in' its answer the defence of its ultra vires to make the contract sued upon. The case is considered on its merits on this point.
*598The powers of the trust company at the time of these transactions were in substance, as far as here material, the same as those set out in G. L. c. 172. For convenience, reference will be made to the relevant sections of that chapter rather than to the sections of the statutes then operative. The general banking powers of a trust company are found in § 31 and the sections immediately following. By § 33 a trust company is empowered to advance money or credits on real estate in this Commonwealth, subject to limitations not here relevant, and on personal security, and to invest its money or credits in the stock, bonds or other evidences of indebtedness of foreign and domestic corporations and governments. By § 36 a trust company may “ accept for payment at a future date drafts and bills of exchange drawn upon it, and issue letters of credit authorizing holders thereof to draw drafts upon it, or its correspondents, at sight or on time,” with conditions not here material. By § 37 a trust company may “ accept drafts or bills of exchange drawn upon it and growing out of transactions involving the import or export of goods, having not more than six months’ sight to run ” subject to certain limitations. “ Such corporation may rediscount notes, drafts and bills of exchange arising out of actual commercial transactions.” A trust company is clothed with whatever further incidental powers fairly may be implied from those expressly conferred and such as are reasonably necessary to enable it fully to exercise those powers according to common commercial and banking customs and usages. Teele v. Rockport Granite Co. 224 Mass. 20, 25.
A trust company invites deposits from the general public. It is empowered not only to conduct the general banking and other business already indicated; it also may have a savings department and a trust department, wherein large numbers of people may be concerned, with interests differing from those of ordinary commercial depositors. The customers of a trust company in all its departments are obliged in the nature of things to repose a high degree of trust and confidence in the fidelity and sagacity of the managers of such an institution. They must depend to a great extent upon *599their honesty and good judgment. The embarrassment, confusion and suffering in business and other financial relations likely to follow in the wake of violations of law or unsound banking methods have been acutely illustrated in the recent failures of several trust companies in this Commonwealth. The business of banking is of such widespread public importance as to warrant and receive considerable governmental regulation for the general welfare.
The contract of guaranty upon which this action is founded does not fall within the specific enumeration of powers conferred upon a trust company already summarized. It was not an agreement to pay drafts or bills of exchange drawn on this trust company. It was not an acceptance of such instruments already drawn or to be drawn in the future. It was not the issuance of a letter of credit. The contract here in suit is closely akin to contracts well within the corporate powers of the trust company. It related to payment of drafts arising out of importations of goods and to liabilities primarily undertaken under a letter of credit. The drafts which were the subject of the guaranty were not drawn on the guarantor, but on the plaintiffs. The letter of credit was not issued by the defendant but by the plaintiffs. The security of the bills of lading and other papers and of the imports was not assured to the defendant but to the plaintiffs.
There must be a dividing fine between business within and business beyond the corporate powers of a trust company. This contract grew out of transactions relating to the import of goods. But it cannot by any stretch of definition or description be rightly termed a draft or bill of exchange. A guaranty of the financial obligations incurred by an importer to another banker is different in kind from the business described in the sections delimiting the corporate powers of a trust company. It is not fairly incidental to the powers there conferred. All these considerations lead us to the conclusion that this contract of guaranty was ultra vires the trust company. Ward v. Joslin, 186 U. S. 142. Gause v. Commonwealth Trust Co. 196 N. Y. 134. Border National Bank of Eagles Pass v. American National Bank of San Francisco, 282 Fed. Rep. 73, 77, certiorari de*600nied, 260 U. S. 701. Commercial National Bank v. Pirie, 82 Fed. Rep. 799, 802. Norton v. Derry National Bank, 61 N. H. 589. First National Bank of Moscow v. American National Bank of Kansas City, 173 Mo. 153. Hotchkin v. Third National Bank of Syracuse, 219 Mass. 234. Dresser v. Trailers’ National Bank, 165 Mass. 120. Flitner-Atwood Co. v. Fidelity Trust Co. 249 Mass. 333.
The uncontradicted testimony at the trial was that it was the custom for trust companies to guarantee letters of credit. Such a custom cannot stand against a rule of law. Conahan v. Fisher, 233 Mass. 234, 238-242, and cases there collected. As was said by Chief Justice Gray in Davis v. Old Colony Railroad, 131 Mass. 258,259-260, “ A corporation has power to do such business only as it is authorized by its act of incorporation to do, and no other. It is not held out by the government, nor by the stockholders, as authorized to make contracts which are beyond the purposes and scope of its charter. ... If it makes a contract manifestly beyond the powers conferred by its charter, and therefore unlawful, ... a court of common law will sustain no action on the contract against the corporation. . . . There is a clear distinction . . . between the exercise by a corporation of a power not conferred upon it, varying from the objects of its creation as declared in the law of its organization, of which all persons dealing with it are bound to take notice; and the abuse of a general power, or the failure to comply with prescribed formalities or regulations, in a particular instance, when such abuse or failure is not known to the other contracting party.” The case at bar falls within the first, not the second; of these classes. Attorney General v. New York, New Haven & Hartford Railroad, 197 Mass. 194, 197. Timberlake v. Order of the Golden Cross, 208 Mass. 411, 422. Hampden Railroad v. Boston & Maine Railroad, 233 Mass. 411.
The plaintiffs invoke the principle stated by Mr. Justice Knowlton in Nims v. Mount Hermon Boys’ School, 160 Mass. 177, 179, 180, with respect to contracts by a corporation in violation of its charter: "... courts have frequently held that, while such contracts considered' merely as contracts *601are invalid, they involve no such element of moral or legal wrong as to forbid their enforcement if there has been such action under them as to work injustice if they are set aside. Courts have been astute to discover something in the nature of an equitable estoppel against one who, after entering into such a contract and inducing a change of condition by another party, attempts to avoid the contract by a plea of ultra vires. It is said that such a plea will not avail when to allow it would work injustice and accomplish legal wrong. Leslie v. Lorillard, 110 N. Y. 519. Leinkauf v. Lombard, 137 N. Y. 417, 423. Many cases might be supposed in which it would be most unjust to hold that one who had received the benefits of such a contract might retain them and leave the other party without remedy, as he might do in a supposable case, where another had put himself at a disadvantage on the faith of a contract with him to commit a crime.” That is a just and salutary principle. It is applicable to cases where the corporation setting up the defence of ultra vires has received property or gain through .reliance by others upon its own conduct and thereafter seeks to retain the advantage it thus has secured by interposing as a shield its unlawful conduct. It is applicable also to cases where the corporation sues to recover compensation for property or gain transferred by it to a defendant who tries to escape just responsibility by setting up ultra vires conduct of the corporation. That path to avoid payment for what he has received is closed to such a defendant. That principle would hold a guarantor accountable to the person guaranteed up to the amount of his undertaking for property coming to his hands upon the inducement of the guaranty regardless of the ultra vires of the guaranty. That principle is at bottom that, when in equity and good conscience one has property without right which ought to go to another, he cannot retain it. The action is not on the express ultra vires contract but on an implied contract to return or make compensation for property or money which he has no right to retain. People’s Bank v. National Bank, 101 U. S. 181, 183. Central Transportation Co. v. Pullman’s Palace Car Co. 139 U. S. 24, 60. Aldrich v. Chemical National Bank,
*602176 U. S. 618. First National Bank of Aiken v. J. L. Mott Iron Works, 258 U. S. 240. That is the principle on which rest Vought v. Eastern Building & Loan Association, 172 N. Y. 508, and Eastern Building & Loan Association v. Williamson, 189 U. S. 122. Numerous of our cases illustrate that principle in various aspects. Prescott National Bank of Lowell v. Butler, 157 Mass. 548. Slater Woollen Co. v. Lamb, 143 Mass. 420. New York Bank Note Co. v. Kidder Press Manuf. Co. 192 Mass. 391, 404. Smith v. Stoughton, 185 Mass. 329, 333. Duggan v. Peabody, 187 Mass. 349, 351. Nashua & Lowell Railroad v. Boston & Lowell Railroad, 164 Mass. 222, 223. L’Herbette v. Pittsfield National Bank, 162 Mass. 137.
The plaintiffs in the case at bar have not transferred anything of value to the defendant trust company. They have parted with money on account of the Mosser Company in reliance on the guaranty of the trust company. None of that money appears to have gone to the defendant. The trust company has not received anything directly or indirectly from the plaintiffs. The contract made by the plaintiffs with the Mosser Company has been executed by them depending upon the guaranty of the defendant. The record fails to show any advantage to the trust company from the performance by the plaintiffs of their contract on their letter of credit issued to the Mosser Company.
The rule as to ultra vires contracts often is stated in the form that “ a corporation cannot avail itself of the defence of ultra vires when the contract has been, in good faith, fully performed by the other party, and the corporation has had the benefit of the performance and of the contract. . . . It may be that while a contract remains unexecuted upon both sides, a corporation is not estopped to say in its defence that it had not the power to make the contract sought to be enforced, yet when it becomes executed by the other party, it is estopped from asserting its own wrong and cannot be excused from payment upon the plea that «the contract was beyond its power.” Vought v. Eastern Building & Loan Association, 172 N. Y. 508, quoted with approval in Eastern *603Building & Loan Association v. Williamson, 189 U. S. 122, 129. Lewis v. Fifth-Third National Bank of Cincinnati, 274 Fed. Rep. 587, 594. Grand Valley Water Users’ Association v. Zumbrunn, 272 Fed. Rep. 943, 949. That statement of the rule broadly interpreted might at first sight be thought to stretch to the facts here disclosed. But it is to be noted that one element of the estoppel there formulated is that “ the corporation has had the benefit of the performance of the contract.” We think it will be found that that principle has been applied only in instances where the fruits of the ultra vires contract have inured to the benefit of the corporation setting up ultra vires as a defence and that it has not been applied in instances where the benefit of the executed contract has gone to someone else. No actual benefit is shown to have been conferred on the defendant by the performance of the contract here in suit. That this must be the significance of the rule as thus phrased seems manifest from the strong and unequivocal statements of the rule of ultra vires in California Bank v. Kennedy, 167 U. S. 362, 367, 368, McCormick v. Market Bank, 165 U. S. 538, 550, Citizens’ Central National Bank v. Appleton, 216 U. S. 196, Merchants’ Bank of Valdosta v. Baird, 90 C. C. A. 338.
The plaintiffs do not rely on an implied contract arising from any gain to the trust company flowing from its guaranty. They bring their action directly and wholly on the express contract of guaranty. That contract is ultra vires the trust company. As already pointed out, they cannot maintain an action on that contract. They do not seek to recover the dollar recited in the contract of guaranty as having been paid by them to the trust company as consideration therefor. A different question would be presented if the defendant had received any gain from the Mosser Company.
The doctrine of equitable estoppel often prevents a corporation from setting up ultra vires. It frequently is invoked against purely business corporations. But it cannot rightly be held applicable under the circumstances here disclosed against a corporation having such important public functions *604as a trust company. There is every reason to hold the rule of ultra vires with some strictness respecting trust companies. The public interest that such a corporation shall not transcend its powers and embark in speculative or even legitimate business enterprises outside its lawful functions is peculiarly strong.
Judgment on the verdict.