All other counts of the complaint having been eliminated by various rulings of the court below and the action of the plaintiff, who is appellee here, this case went to the jury upon the tenth count alone. One defense, much relied upon, was that'the plaintiff, being a foreign corporation, had not, at and before the time of its alleged partial performance of the contract between the parties out of which the suit arose, complied with that statute of the state which requires, under penalty, that every corporation not organized under the laws of this state, shall, before engaging in or transacting any business in this state, file an instrument in writing in the office of the Secretary of State designating at least one known place of business in this state and an authorized agent or agents residing thereat. — Code 1907, § 3642. In section 3644 it is provided that it is unlawful for any foreign corporation to engage in or transact any business in this state before filing the written instrument provided for in section 3642. These statutes were passed in aid of well-known constitutional provisions to the same effect. — Const. 1875, art. 14, § 4; Const. 1901, § 232. Some propositions in connection with these constitutional and statutory provisions have been settled by the decisions of this court. They constitute a police .regulation for the protection of the property interests of the citizens of the state, as much so “as the law forbidding vagrancy among its inhabitants.-Am. Union Tel. Co. v. West. Union Tel. Co., 67 Ala. 26, 42 Am. Rep. 90. The doing of a single act of business, if it be in the exercise of a corporate function, is prohibited. The policy of the Constitution and statute is to protect our citizens against the fraud and imposition of insolvent and unreliable corporations, and to place them in an attitude to be reached by legal process from our courts in favor of citizens having cause *403of complaint. Foreign corporations may not sue until they put themselves in a position to be sued in domestic courts. — Farrior v. New England Mfg. Co., 88 Ala. 275, 7 South. 200. The conditions are fixed, inflexible, and unalterable. — Sullivan v. Timber Co., 103 Ala. 371, 15 South. 941, 25 L. R. A. 543. A contract to pay for an act or service promised to be done or performed in violation of this statute is illegal, and, as long as it is ex-ecutory, the courts will not lend their aid to its enforcement. — Dudley v. Collier, 87 Ala. 431, 6 South. 304, 13 Am. St. Rep. 55.
Evidently with this statute and these decisions in mind, the pleader in framing the tenth count set himself to the statement of a cause of action which would be beyond the reach of a demurrer asserting their unfavorable application to his case. Under a caption which discloses that the plaintiff is a corporation, without more, it is averred that the parties entered into a contract in the city of Chicago, state of Illinois, by which plaintiff undertook and agreed to build a railroad in the state of Alabama for a compensation to be paid by the defendant; the amount depending upon the quality of earth and rock moved. The allegation then is that in the execution of the contract the plaintiff sublet the work to sundry independent contractors, agreeing to pay them for their work. These contracts of subletting were entered into at Memphis, Tenn., and there, as the count alleges, became effective and binding between the parties thereto. Then follows an allegation, to epitomize it, to the effect that the subcontractors had performed a large part of the work, and had continued to perform it until the defendant refused to pay installments as agreed, whereupon the plaintiff ceased work under the contract. The count seeks to recover a balance due upon the work done, and is a count upon the *404contract. Nowhere does it appear that the plaintiff Avas a foreign corporation, and therefore the demurrer, which took the point that the plaintiff had engaged in the work of building the ralroad in contravention of the Constitution and laws hereinabove set out, was properly overruled.
The defendant interposed the same defense in the shape of a plea designated as “NN.” This plea averred that the'plaintiff was a corporation chartered under the laws of the state of Tennessee for the purpose, among other things, of building railroads for other persons or corporations; that it entered into the contract counted on; that in the execution of it the plaintiff did business in the state of Alabama; and that prior to so doing it had not filed an instrument in writing in the office of the Secretary of State of Alabama designating a known place of business in this state and an authorized agent or agents residing thereat. The demurrer to this plea went upon the theory, mainly, that the fact that the work in Alabama had been done by independent subcontractors relieved the plaintiff of the charge of having offended against those provisions of the Constitution and laAV to which reference has been made. As it appears to us, this is much, if not altogether, the same thing as to say that the plaintiff may maintain its suit upon the contract by Avhich'it undertook to build the railroad, at the same time maintaining, in order to obviate the defense interposed, that it did not do the building. The appellee Avill not, of course, concede that its contention is fairly capable of statement in this shape; but we believe a consideration of its true inwardness will show it to be in effect, if not in form, nothing more. The cases of Beard v. Publishing Co., 71 Ala. 60, Sullivan v. Timber Co., 103 Ala. 371, 15 South. 941, 25 L. R. A. 543, International Cotton Seed Co. v. Wheelock, 124 *405Ala. 367, 27 South. 517, State v. Anniston Rolling Mills, 125 Ala. 121, 27 South. 921, and Abraham v. Southern Ry., 149 Ala. 547, 42 South. 837, except for the general test laid down, which was that there must be a doing of some of the works, or an exercise of some of the functions for which the corporation was created, contribute nothing to the solution of the question here raised. Those cases merely held that the doing of the certain several particular acts there shown did not measure up to the test — did not constitute the performance of the functions for which the corporations were chartered.
In the case under consideration the plea avers that the cause of action declared on arose out of a contract for the building of a railroad in Alabama, and that the plaintiff corporation was organized in the state of Tennessee for the purpose of building railroads for other persons and corporations. The averments of count and plea taken together, plaintiff’s avenue of escape from the conclusion that it violated the statute is to be found in its asserted proposition that the building of the railroad was the act of the subcontractors only, and not the act of plaintiff, within purview of statute and Constitution. Accordingly the demurrer took the point that the plea was bad, because it did not deny the averment that the work had been done by independent subcontractors; and now the argument is that the subcontractors were not the agents of the plaintiff, for the reason only that they were contractors and were independent. It might well be considered that the plaintiff closed the door upon this contention when it entered into the contract; for the contract, which is set out in extenso in the count, stipulated that “the contractor shall not be relieved under any circumstances from the immediate charge and responsibility of the work, and no part thereof shall be transferred or sublet to any person or persons, except *406by the written, consent of the railroad company. In case such consent is given, it shall not relieve the contractor from any of the obligations of this contract, and any transferee or subcontractor shall be considered as the agent of the contractor, and as between the parties hereto the contractor shall be and remain liable as if no such transfer or subletting had been made.” We make no point here that the contract was not assignable with the subsequently given verbal or implied consent of the defendant. The averment of the count is, not that there was an assignment, but that there was a subletting. But, looking at the question from the standpoint taken by the state when it adopted the constitutional and statutory regulations bearing upon the subject, the character of intervening agencies employed by the plaintiff in carrying out its contract to build the railroad appears to be immaterial. The question is: Did it engage in the business of building railroads? The ease of plaintiff’s way to the conclusion that it did not is supposed to be increased by the fact that the subcontractors were independent. Rather, it may be said, the entire contention turns upon the merits of the Avord “independent.” If plaintiff and its subcontractors stood to one another in the mere relation of contractee and contractors, then according to the general and correct understanding the relation of principal and agent existed. Does not a corporation engage in the performance of its corporate functions when it secures the doing of the thing it Avas chartered to do through the employment of contractors; and, if so, does it not transact business at the place where the Avork is done? We think so.
But the contractors were independent, it is said; and definitions of an independent contractor are quoted to the effect that “an independent contractor acts for himself in doing the work, and simply agrees to give his *407employer the benefit of the result when the work is completed.” — Kent, Com.. (13th Ed.) 260, note. More accurately, we think the relation is defined in Rome, etc., R. R. v. Chasteen, 88 Ala. 591, 7 South. 94, quoting from 1 Shear. & Red. Neg. § 164, where it is said: “The true test, as it seems to us, by which to determine whether one who renders service to another does so as a contractor or not, is to ascertain whether he renders service in the course of an independent occupation, representing the ivill of his employer only as to the result of his work, and not as to the means by which it is accomplished.” In recognition of the purpose for which this doctrine is applied, it may be conceded that the relation between plaintiff and its contractors conferred upon plaintiff a certain limited exemption from liability for the acts of its subcontractors and the servants and employes of the latter. The relation between them was nevertheless that of contractée and contractors, principal and agents, and the fact remains that in the discharge of the agency the subcontractors constructed the road. The result contracted for and partially wrought out represented the will of the plaintiff in every sense as perfectly as if it had employed and superintended by and through its own proper officers the men who handled pick and shovel and plow, and its will was accomplished in Alabama. The exemption from liability for the acts of subcontractors, relied upon as differentiating this from the ordinary case of principal and agent, if pertinent to the issues, is not universal. The plaintiff could not thus evade its public duties. It could not, for example, escape responsibility for the negligence of its subcontractors in crossing roads and streams along which the public travel, and, of course, it could not on this ground evade responsibility to the defendant and its own subcontractors arising out of the physical ex-*408edition of the contract in this state. If this he not so, the Constitution and statute have contrived to little purpose. Our conclusion, then, is that, if the plaintiff constructed the railroad by the employment of subcontractors under the conditions predicated in the count and plea, it had more than a mere pecuniary interest in the Avork. It was not a mere guarantor. It was interested as principal. It engaged in the exercise of its corporate functions in this state, notAvithstanding it employed independent subcontractors to do the actual work.
We are not inclined to concur in appellant’s contention that the contract was void ab initio because compliance with the statute did not antedate its execution. Necessarily, hoAvever, the contract Avas entered’ into with the purpose that it should be executed in this state. It could not be executed elsewhere. It must be taken to have contemplated legal action by the plaintiff, since compliance with the statute was a condition precedent of plaintiff’s right to build the railroad. A promise to comply is implied as an essential and necessary element of the contract, if it is to be sustained and enforced as a valid agreement. When the time came for the execution of the agreement, and the plaintiff failed to take the necessary steps to comply Avith the statute — -thus leaving the defendant without a protection for which he had stipulated, viz., the power to redress any wrong which it might suffer in the courts of this state — the defendant had a right under the law to renounce the contract, then or at any subsequent time, as for a breach by the plaintiff. — Diamond Glue Co. v. United States Glue Co., 187 U. S. 611, 23 Sup. Ct. 206, 47 L. Ed. 328. The statute requires that an instrument in Avriting shall be filed with the Secretary of State before engaging in or transacting any business in this state. Its purpose has been stated. That purpose is not to be accomplished *409by a filing at the pleasure of the corporation, or when it may be to its interest to appeal to the courts of tbis state. We may safely affirm that nothing short of a compliance before any business is engaged in or transacted in tbis state satisfies either the literal requirement of the statute and Constitution or their policy. — Pittsburgh Construction Co. v. West Side R. R. Co., 154 Fed. 929, 83 C. C. A. 501, 11 L. R. A. (N. S.) 1145.
Tbe plea was not demurrable as stating a mere conclusion. There was no occasion to repeat tbe averments of tbe count in respect to tbe contract and tbe work done under it. It averred with certainty and necessary particularity tbe facts which it needed to aver, viz., that tbe plaintiff was a foreign corporation and bad not. prior to tbe time it did tbe work, filed an instrument in writing in tbe office of the Secretary of State, designating a known place of business in Alabama and an authorized agent or agents residing thereat. There was error in sustaining tbe demurrer to tbe plea, for which tbe cause must be reversed. Tbis disposes of tbe case in its broadest aspect. We will not assume that there may be effective response to tbe plea. Tbe parties at tbe trial went into tbe evidence, which showed without contradiction and indisputably that tbe plaintiff was a foreign corporation and bad failed to comply with tbe statute. We will not, therefore, consider other assignments of error.
Reversed and remanded.
Dowdell, O. J., and Anderson and McClellan, JJ., concur. , ■