delivered the opinion of the court.
The complaint in this ease contains two causes of action. The first seeks recovery of damages for the removal by defendants of certain railroad tracks from mining property belonging to the plaintiffs. The second is for damages for the carrying away by the defendants and converting to their own use the material—rails, fish-plates, etc.—which constituted the tracks. The defendants interposed a separate general demurrer to each of the causes of action, which the court sustained. The plaintiffs refusing to plead further, judgment was entered in favor of the defendants. The appeal is from the judgment.
*284The complaint is very prolix. The facts constituting the first cause of action may be epitomized as follows: The plaintiff [1] Helena & Livingston Smelting & Reduction Company, referred to in this statement as the Smelting Company, is a Montana mining corporation. The plaintiff Montana Silver Lead Company, referred to as the Montana Company, is also a Montana corporation. The plaintiff Boston & Alta Copper Company, referred to as the Copper Company, is a West Virginia corporation. By virtue of its compliance with the laws of Montana it is entitled to do business in this state. The defendant Northern Pacific Railway Company is a Wisconsin corporation, the successor of the Northern Pacific Railroad Company, owning and operating an interstate railway through the state of Montana. It will be mentioned as the railway company. The defendant Hugh McConnell was, at the times when the wrongs for which recovery is sought herein are alleged to have been committed, a contractor of the railway company, and through his agency the wrongs were done. On December 18, 1909, the Smelting Company was the owner and in possession of several contiguous mining claims, constituting one- consolidated claim, and a mill site, described in the complaint, together with the buildings necessary to the operation of the claim,, including a concentrator and mill used for the reduction of the ores extracted from the claim and the preparation of them for market. On that date the Smelting Company conveyed the property to A. E. Spriggs, who immediately executed and delivered to the Smelting Company a mortgage upon it' to secure the payment of the sum of $150,000. On the same date A. E. Spriggs conveyed the property to the Copper Company, which thereupon became the owner of it, subject to the mortgage, and continued to be the owner of it until it conveyed the same to the Montana Company. This conveyance was made on September 15, 1916. The Montana Company thereupon became the owner of it, subject to the mortgage held by the Smelting Company. The plaintiffs and their predecessors have at different times extensively operated the mines, and the plaintiff Mon*285tana Company is now engaged in conducting- operations and expending large sums of money in this behalf. Large quantities of valuable metals have been extracted from the mines, and large bodies of valuable ores are still contained therein.
For more than thirty years last past, and until removed by defendants, certain railroad tracks were situated upon and affixed to the mines and mining property,"the same being laid upon and securely fastened to cross-ties, imbedded in the soil and graded into the surface of the mining property at great expense. A portion of the tracks consisted of a mile and a half which originally constituted a part of a branch line extending from- the town of Jefferson, in Jefferson county, through the town of Corbin, and traversing the mining property above described, to the town of Wickes, the town of Corbin lying approximately midway between the towns of Jefferson and Wickes. This branch line was an offshoot from a line owned and operated by the defendant railway company and its predecessor, then extending from East Helena, Montana, to Boulder, Montana, and connected with the main line of the railway company and its predecessor at the town of East Helena. Some thirty years ago, while the line from East Helena to Boulder and the branch from Jefferson to Wickes were in existence, there was also an offshoot or spur extending from the Wickes branch at a 'point about a mile south of Corbin into and upon the mining property, called the Alta spur. This spur was divided into two branches, one called the high line and the other the low line, the former extending above the plaintiffs’ concentrator, which was situated on a side hill, and the other extending below the concentrator. Each of these lines to the extent of about 2,000 feet was situated wholly upon the plaintiffs’ mining property. The spur and the high and low lines were constructed solely for the use, benefit, and development of the mining property, and were and are essential to the proper operation and development of it, and the operation of the mill and concentrator, being necessary for the transportation of materials and supplies *286to the mines and the removal of the ores, concentrates and other products therefrom. The defendant railway company and its predecessor furnished the rails, fish-plates, etc., for the construction of the spur and high and low lines, and all of them, especially the high and low lines, were constructed and have been maintained and kept in repair by plaintiffs añd their predecessors at their own expense, the rails and other steel having been furnished for the construction of these tracks by the defendant company as an inducement to the plaintiffs to operate the mine, concentrator and mill, and to ship ores, concentrates and other products over the lines of the company and its predecessor in interest, they receiving all shipments to and from the mine.
At the times mentioned the only railroad connected with the mines, and available for the direct shipment to and from the same, was the railway of the defendant, and the branch line, spur, etc., above referred to. While they were in existence all the freight to and from the mines was handled by the defendant railway company and its predecessor in interest. The spur and the high and low lines were situated in the only feasible position to furnish proper ingress and egress to and from the property, and for connection with any railroad now or at any time heretofore in existence and accessible from the mining property. For this reason they were, and now would be, most useful in such position for the operation of the property. Until they were removed they were appurtenant to and affixed to the mining property. Several years ago the line from East Helena to Boulder and the Jefferson-Wickes branch, extending from the town of Jefferson to a point between Jefferson and Corbin about one mile south from Corbin, and from the concentrator, were removed by the defendant company, and a connecting track installed by the defendant company between the Great Northern Railway, which passes along the side hill several hundred feet above the concentrator, and a point on the Wickes branch between Corbin and Wickes about a mile and a half from Corbin, and the portion of the *287said branch lying upon the Alta mines was so arranged that the same could be, and was, used by the plaintiffs, or some of them, in connection with the operation of their mill, for the removal and reduction of tailings from the concentrator. After the removal of a portion of the Wickes branch transportation to and from the Alta mines was had by means of this connection with the Great Northern Railway, and the portions of the branch line situated upon the Alta mine and the Alta spur, with the high and low lines, were used as theretofore in the operation of the mines. In the meantime large sums of money were expended upon these tracks by plaintiffs, or some of them, for the repair thereof and the adjustment of the same to the uses and purposes desired by them, all being situated upon the property of plaintiffs. There are now more than 25,000 tons of tailings situated upon the property of plaintiffs, containing quantities of valuable metal. The Alta spur and the high and low lines, and also the portion of the branch line so situated upon and connected with the mines, and used therewith, were at all times fixtures of the said mines, and belonged to the plaintiffs and their predecessors in interest as a part thereof.
No agreement was ever made between the plaintiffs, or their predecessors, and the defendant railway company or its predecessor whereby this defendant, or its predecessor, retained or was given any right to remove any portion of the tracks, but the same were constructed, maintained and used solely for the benefit of the mines as aforesaid.
The Wickes branch was constructed at the expense of the predecessors in interest of the plaintiffs, but the cost of constructing the same was thereafter returned to the plaintiffs and their predecessors in the way of freight rebates, but no agreement was ever made between the predecessors in interest of the plaintiffs with the defendant railway company or its predecessor with reference to the ownership of the said branch line when completed, and no agreement made for the removal thereof by the defendant company or its predecessor. In re*288moving these tracks it was necessary to destroy the same as tracks, to tear the rails from the ties, and destroy a considerable portion of the value of the materials by so doing.
It is alleged that, until the removal of the tracks, plaintiffs and their predecessors in interest were in the open, notorious, continuous and uninterrupted possession of the mines and all properties situated upon or appurtenant thereto, including the tracks mentioned, and that neither plaintiffs nor any of their predecessors in interest knew that the defendant railroad company claimed the right to remove the tracks or any of them, or claimed to have any interest in them; that the concentrator is necessary to the proper and profitable operation of the mines for the treatment of ores extracted therefrom; that the same is situated upon the only site upon which a con•eentrator can be operated and used in connection with the development and operation of the mines; that during the month of December, 1913, and the month of January, 1914, the defendants, without the consent of the plaintiffs or any of them, and without notice to or knowledge of the plaintiffs, wrongfully and without authority of law entered upon the mining property and tore up and removed the rails therefrom, and tore up and removed the Wickes branch from the mine to the point of its connection with the Great Northern Railway; that in committing these acts the defendant Hugh McConnell was acting for, and on behalf of, -and jointly and in concert with, the defendant railway company under a contract entered into 'by him with this defendant for the removal of the tracks; that by the removal and destruction of the tracks plaintiffs have been damaged in the sum of $25,000, no part of which has been paid.
The allegations constituting the second cause of action are for all practical purposes identical with those contained in the first, except that it alleges the wrongful removal and conversion by the defendants of the steel rails, etc., of which the track was in part composed; that defendants acted therein *289jointly; and that the rails, etc., were at the time of their removal of the reasonable value of $10,000.
Upon an examination of the complaint, the inquiry at once suggests itself whether there is not a misjoinder of parties plaintiff. The Smelting Company parted with its title to the mining property on December 18, 1909, whereas the injuries to it for which a recovery is sought occurred in December, 1913, and January, 1914. At that time this plaintiff had no interest in the property, other than as its security tinder the mortgage for the debt due it. This situation pre[2] sents the inquiry: May a mortgagee maintain an action for an injury to the mortgaged property unless he can allege and prove that his security has been impaired by the injury? The complaint contains no allegation in this behalf. As to the Montana Company, the question is suggested whether, it having become the owner of the property in 1916, long after the injuries are alleged to have been done, it may maintain an action because of them without allegation and proof that by its deed from the Copper Company, or otherwise, it became vested with the rights of action which had theretofore arisen in favor of the Copper Company in 1913 and 1914. A further inquiry is also suggested, namely, whether the mortgagee, the Smelting Company, may join with the mortgagor and its grantee, or either of them, in an action for damages for an injury to the mortgaged property. We do not venture to decide any of these questions, because the general demurrers do not raise them, and counsel for neither side have referred to them. We therefore pass them without consideration.
The allegations of the complaint are not arranged in a logical and consecutive order, but, in our opinion, are sufficient in substance to require the defendants to answer. They may be briefly epitomized as follows: That the property of plaintiffs consists of mines; that the Alta spur, including the high and low lines, was constructed by the predecessors in interest of the plaintiffs out of material furnished by the predecessor of the defendant company, being laid upon and securely fastened to *290cross-ties imbedded in tbe soil by being graded into the surface at great expense; that it was constructed and actually used and maintained at plaintiffs’ expense for working and developing the mines; that the portion of the track upon plaintiffs’ property constituting a part of the "Wickes branch was constructed at the expense of the plaintiffs and their predecessors, was adapted to the use of the plaintiffs in their mining operations, was -maintained at their expense, and was used in connection with the handling of the tailings deposited upon the property in the operation of the concentrator, the plaintiffs being reimbursed by the defendant or its predecessor by way of rebates in freight charges; that the tracks were constructed solely for the use and benefit and development of the Alta mines, and were essential to their proper operation and development ; that no agreement was ever made between the predecessors in interest of the plaintiffs and the defendant railway company or its -predecessor with reference to the ownership of these tracks, and no agreement was ever made for the removal thereof by the defendant company or its predecessor; that the plaintiffs acquired the property from their predecessors without notice of any claim by the defendant railway company of any right to remove the tracks.
To uphold the judgment, counsel for the defendants contend that, the tracks having been placed upon the property and operated by the Northern Pacific Railroad Company, the predecessor of the defendant railway company, by the consent of the plaintiffs, the predecessor of the defendant company and the defendant were licensees; that the license, having been created by parol, was revocable at any time; and that, upon the revocation of the license, the defendant railway company had the right to remove the rails, etc. In support of this contention they cite the case of Great Falls Water Works Co. v. Great Northern Ry. Co., 21 Mont. 487, 54 Pac. 963, and Archer v. Chicago etc. Ry. Co., 41 Mont. 56, 137 Am. St. Rep. 692, 108 Pac. 571, They also contend that whether these cases *291apply or not, railroad rails, etc., used by a railway company in constructing a track upon the property of another. lying along its line of road are generally considered trade fixtures, and do not become a part of the real estate upon which they are laid.
It may be remarked in passing that the plaintiffs do not occupy the position of bona fide purchasers. Such a pur[3] chaser is: “One who, at the time of his purchase, advances a new consideration, surrenders some security or does some other act which leaves him in a worse position if his purchase should be set aside and purchases in honest belief that his vendor had a right to sell, without notice, actual or constructive, of any adverse rights, interests or equities of others in and to the property sold.” The foregoing definition quoted from the text of 5 Cye. 719, was approved by this court in Foster v. Winstanley, 39 Mont. 314, 102 Pac. 574. The allegations of the complaint do not bring the plaintiffs within its terms.
We do not think that either the defendant railway com-[4] pany or its predecessor, as a matter of law, comes technically within the category of a mere licensee. The Alta spur, including the high and low lines, was constructed by the plaintiffs, the steel and fastenings being furnished by the predecessor of the defendant railway company, but, until removed, it was maintained by the plaintiffs at their own expense. What agreement was then made or understanding had as to the title to the rails, etc., upon the cessation of mining operations or at any other time, does not appear. So far as the facts alleged disclose anything on the subject, it cannot be determined whether the Northern Pacific Railroad Company made a gift of the rails, etc., to the plaintiffs or ever intended to reclaim them. The facts connected with the construction of the Wickes branch are different, but there was no understanding had or agreement made as to what should become of the rails and fastenings when mining operations should cease. However this may be, it does not appear that mining opera*292tions have ceased, nor that, if the Northern Pacific Railroad Company and the defendant company were technically licensees, the license was ever revoked directly upon notice by the plaintiffs, or indirectly by plaintiffs’ cessation of mining operations thereby relinquishing the arrangement they had enjoyed up to that time by the use of the tracks. An examination of the cases cited will demonstrate that they do not apply; for in each of them was considered the right of one who was a parol licensee upon what amounted to a formal revocation of his license.
Section 4428 of the Revised Codes of 1907 provides: “Railway tracks * * * used in working or developing a mine, are to be deemed to be affixed to the mine.”
Section 4572 declares: “When a person affixes his property to the land of another, without an agreement permitting him to remove it, the thing affixed, except as provided in section 4578, belongs to the owner of the land unless he chooses to require the owner to remove it.”
The exception mentioned in section 4572 is the following: “A tenant may remove from the demised premises any time during the continuance of his term, anything affixed thereto for purposes of trade, manufacture, ornament, or domestic use, if the removal can be effected without injury to the premises, unless the thing has by the manner in .which it is affixed, become an integral part of the premises.” Taking all these [5] provisions, together" with sections 4425 and 4427, defining real and personal property, and specifying how the latter may be affixed to the former, it is apparent that, whether the tracks in question became affixed to the plaintiffs’ mining property within the meaning of section 4428 or not, there can be no question that the defendant company and its predecessor were not at any time tenants of the plaintiffs; for it does not appear 'that a contract of hiring existed between them. The facts alleged preclude the notion that they bore toward each other the relation of landlord and tenant. Even so, it does not follow as a matter of law, that the tracks were trade fixtures, *293and subject to removal by the defendants as such. Whether they were or not depends upon the relation existing between the parties, at the time the tracks were laid and their intention with respect to them.
In Mattison v. Connerly, 46 Mont. 103, 126 Pac. 851, this court in considering this subject, said: “The intention with which the fixture is attached or affixed to realty is always a pertinent inquiry in determining the status of what seems to be realty or personalty, as the case may be.”
In Montana Electric Co. v. Northern Valley Min. Co., 51 Mont. 266, 153 Pac. 1017, after referring to sections 4424, 4425 and 4427, and also quoting section 4428 of the Revised Codes, we also said: “The purpose of the Code was not to introduce new rules or definitions into the law, but rather to reduce to concise form the rules of law as they were then recognized and applied by the courts. Reference to New York and California decisions aids in determining the scope which the provisions of our Code above, were intended to have, and from those decisions we deduce the following: (1) Whether what would otherwise be personal property has become a fixture by reason of its attachment to the soil, is primarily a question of intention on the part of the person attaching it; (2) the attachment in the manner indicated in our Code sections above, raises a presumption that the one who made the attachment intended the thing affixed to become a part of the realty; this presumption, however, is a disputable one; (3) as a general rule, the manner in which the attachment is made, and the intention of the one making the attachment, determine whether the thing is realty or personalty.”
It will be observed that these cases were decided upon the facts introduced in evidence in support of issues made by the pleadings as to what the respective rights of the parties were. We deem them conclusive of the first contention made by counsel; for, though the steel, etc., out of which the Alta spur was constructed belonged to the predecessor of the defendant railway company, and that out of which the Wickes branch *294was constructed was paid for by the predecessor of the defendant railway company, it is clear that the installment of both was made for the mutual benefit of the plaintiffs and the company, and the intention of the latter with • reference to them must be determined from the facts and circumstances introduced at a trial on the merits.
As to the second contention, it is the general rule that, where [6] the superstructure of a railroad is placed upon the land of another, the railroad company cannot be said to have intended to attach the rails and other appliances to the land so as to make them a part thereof, and the rule ordinarily applies to sidetracks and spurs constructed by the company to aid it in the discharge of its obligations as a public carrier, as well as to those constructed for the purpose of accommodating the owners of manufacturing and like enterprises situated along or near its main line. (Wiggins Ferry Co. v. Ohio & M. R. Co., 142 U. S. 396, 35 L. Ed. 1055, 12 Sup. Ct. Rep. 188 [see, also, Rose’s U. S. Notes]; Illinois Cent. R. Co. v. Hoskins, 80 Miss. 730, 92 Am. St. Rep. 612, 32 South. 150; Wagner v. Cleveland & Toledo R. Co., 22 Ohio St. 563, 10 Am. Rep. 770; Northern Central R. Co. v. Canton Co., 30 Md. 347; Skinner v. Ft. Wayne etc. R. Co. (C. C.), 99 Fed. 465; Georgia R. & Banking Co. v. Haas, 127 Ga. 187, 119 Am. St. Rep. 327, 9 Ann. Cas. 677, 56 S. E. 313; Toledo etc. R. Co. v. Dunlap, 47 Mich. 457, 11 N. W. 271; Oregon Ry. & Nav. Co. v. Mosier, 14 Or. 519, 58 Am. Rep. 321, 13 Pac. 300.) Some of these cases put steel rails and other appliances in the category of trade fixtures, and hold that they are removable at the pleasure of the railway company when it ceases to use the superstructure of which they form a part, or when their removal becomes necessary for the better accommodation of the public, while others regard such tracks as constructed for public use and enjoyment, and thus distinguish the acts of the company in constructing them from those of trespassers and others who attach their property to the land of another. In the first ease cited it was said: “As between landlord and tenant, or one in *295temporary possession of land under any agreement whatever for the use of the same,.the law is extremely indulgent to the latter with respect to the fixtures annexed for a purpose connected with such temporary possession.”
In the case of Illinois Central R. Co. v. Hoskins, supra, the court, in considering the rights of a plaintiff, who was seeking to eject a railroad company from his land upon which the company had entered and constructed a spur for its own purposes without plaintiff’s permission or acquiring a right to do so by condemnation proceedings, though it held that the company was a trespasser, said: “It is a general rule of law that whatsoever chattels are attached to the realty with the manifest intent that they remain there becomes part and parcel of it, and cannot be removed without the consent of the owner of the freehold to whom they are considered a gift; but to this rule there are exceptions, and among others is the superstructure of a railway company. Such a company exercises the right of eminent domain—a governmental function—and it takes no freehold, but a mere easement, and therefore cannot be said to have intended to attach its rails .and ties and other appliances to the freehold. They are constructed also for public use and enjoyment, and it is their quality in this respect that distinguishes the acts of the company in their construction from those of a trespasser or others; and, if the terms for acquiring this easement are too onerous, it may remove its rails and ties, and p.ass in another direction.”
It may not be overlooked, however, that the conclusion announced in these cases rested upon the facts as they were disclosed showing what must have been the intention of the railway company at the time the particular superstructure was installed. Under the peculiar facts alleged in the complaint, we think the question whether the plaintiffs can recover must be determined by the evidence as to what the intention of the railway company was at the time the tracks were constructed. It is apparent that they were not installed as a necessary or convenient part of the equipment of the railway company to *296serve the general public, but exclusively for service to the mining enterprise of the plaintiffs; that the Alta spur and high and low lines were installed by the plaintiffs out of material furnished by the predecessor of the defendant company, but were maintained by the plaintiffs at their own expense; that for the Wickes branch, originally constructed by plaintiffs, reimbursement was made by the predecessor of the defendant company, but that there was no agreement with reference to the occupancy of the land by the company or with reference to the material out of which the tracks were constructed ; that when the main line from East Helena to Boulder was abandoned defendant company connected the Alta spur and Wickes branch with the Great Northern Railway’s line, so that the enterprise of plaintiffs could be served as before;' and that the railway company and its predecessor had the exclusive right to carry for the plaintiffs while they were entirely dependent upon the spur and the branch line. Conceding it to be the rule that, though it appears that, when such spur and branch lines are necessary and proper for the company to have to perform its obligations as a public carrier, the company has the right to remove them when in its opinion it becomes necessary without subjecting itself to an action for damages for doing so (Helena & Livingston S. & R. Co. v. Northern Pac. Ry. Co., ante, p. 205, 204 Pac. 370, yet when, as here, such tracks are installed upon the property of another solely for the purpose of serving the private enterprise of the owner in order to increase its revenues from that source, and are installed and maintained at the expense of the owner of the enterprise, and cannot be used for any other purpose, it cannot be said as a matter of law that the right of the company rests prima facie upon any other rule than that by which is determined the question: What are and what are not fixtures?
Our attention has not been palled to any authority in point in this regard, but upon principle, under the peculiar circumstances disclosed by the complaint, we think the plaintiffs are entitled to a trial on the merits. Plaintiffs cite and rely with *297confidence on the case of St. Louis & S. F. Ry. Co. v. Beadle, 6 Kan. App. 922, 50 Pac. 988. It is not in point, however, because in that case the plaintiff based her right to recover upon the fact that she was a bona fide purchaser of the land upon which the tracts had been constructed.
As to the second cause of action, no particular discussion is necessary. If the facts as disclosed by the evidence upon the trial justify the conclusion that the rails, etc., were the property of the plaintiffs, it follows as of course that plaintiffs are entitled to recover their value.
The judgment is reversed, and the cause remanded to the district court, with directions to set aside the judgment and overrule the demurrers.
Reversed and remanded.
Associate Justices Cooper, Holloway and Galen concur.