The petitioner was convicted of violating an ordinance of the city and county of San Fran*373cisco, and has sued out a writ of habeas corpus for the purpose of testing the validity of the ordinance. The ordinance is as follows:
“Order No. 2950. Prohibiting the further purchase of lots for burial purposes within the city and county of San Francisco; also providing for further burials being made only in lots heretofore acquired by persons or associations for burial purposes.
“ Whereas, the unlimited burial of the dead within the city and county of San Francisco is dangerous to life and detrimental to the public health; and,
Whereas, the right of those persons or associations who have already purchased lots or plots for their own use or for the use of their families or members in the cemeteries in the city and 'county of San Francisco should be recognized;
“Now, therefore, the people of the city and county of San Francisco do ordain as follows:
“Section 1. It shall be unlawful, after the passage of this order, for any person, association, or corporation to hereafter, within the limits of the city and county of San Francisco, purchase, acquire, sell, lease, or in any other manner dispose of, or make available, any land situated therein for the purpose of interring any human body, or any portion of any human body. Nor shall any interment of any human body be made except in such lots or plots as may have been already purchased by persons, associations, or corporations for their own use, or the use of their families or members; provided, the said lots shall not be used for general interment purposes.”
Section 2 makes a violation of the ordinance a misdemeanor, and prescribes the penalty therefor.
The Odd Fellows’ Cemetery Association was incorporated in 1865, under the act of the legislature entitled “An act to authorize the incorporation of rural cemetery associations” (Stats. 1859, p. 281), and the petitioner is the president of the corporation, and the offense with which he is charged is that, as such president, he *374executed a deed of conveyance of a lot of land within the tract of the cemetery, that had been sold by the association, and ttuereby aided and abetted in the violation of the ordinance. The validity of the ordinance is maintained on behalf of the people, upon the right of the municipality, when authorized thereto by the legislature, to restrict or prohibit burials within its limits, or within certain districts therein, and is resisted upon the ground that in the present case such authority has not been conferred upon the municipality, and also that the ordinance under consideration is unreasonable, by reason of not being operative upon all citizens alike.
By the act of April 25, 1863 (Stats. 1863, p. 540), the board of supervisors of San Francisco have power by ordinance “ to make all regulations which may be necessary or expedient for the preservation of the jrnbljc— health, and the prevention of contagious diseases.” It may beconceded that mKleFthe autlróriljrtírúTgiven, the city of San Francisco could pass an ordinance prohibiting burials of the dead within certain porti ons of the city, but the .power of the legislature to prohibicburials in the entire city, as well as the power of the city to pass ordinances therefor, are questions not presented for consideration in determining the validity or effect of the ordinance under which the petitioner was convicted. This ordinance does not prohibit burials within the city, or within any designated district of the city, nor does it prohibit burials within the cemetery of which the petitioner is president. On the contrary, there is, by the terms of the ordinance itself, an express sanction of the right of those who have purchased lots for the purposes of burial in any portion of the city, to continue to bury human bodies therein until the capacity of the lots is exhausted; and it appears in this case that, in the Odd Fellows’ Cemetery alone, these lots will allow the interment of upward of eighteen thousand- bodies, in addition to those already buried there, while the capacity of the unsold lots, within the same cemetery, is sufficient for only three thousand six hundred bodies. *375There is no restriction in the ordinance upon the persons whose bodies may be buried within these lots that have been sold, except that the lots shall not be used for “general” interment purposes; and, under section 613 of the Civil Code, the owner of a lot may consent to the burial therein of one who had nointerest’mtKe iotT By the terms of the ordinance also burials are permitted of any member of a corporation or association that has purchased a lot within either of the cemeteries of the city, irrespective of the size of the lot or the number of such members, so long as there shall be space within the lots for such burials. The effect of the ordinance is, therefore, in no" respect to prohibit burials, but simply to limit the right to those who have been fortunate enough to secure a lot therefor before the passage of the ordinance.
The fact that the “unlimited” burial of the dead within the city is “ dangerous to life and detrimental to the public health,” may be a sufficient reason for the enactment of an ordinance fixing a term after which such burials shall cease within certain portions of the city, but, while burials are permitted within a district, the privilege cannot be limited to one class of citizens and denied to" another class within the same district. The police power is to be exercised for the good of the entire public, and any restriction of the rights of the individual by virtue of this power must extend to all the individuals who might otherwise exercise the right.
The owner of a lot within a cemetery, who has purchased it for the purpose of burial, holds the same subject to the right of the city to prohibit further burials within the cemetery (Coates v. Mayor, 7 Cow. 585), and has no greater right to use it for burials after such prohibition than has the cemetery association itself to subject its unsold lots to such use. The right to prohibit burials within a certain district rests upon the proposition that any burial within that district is injurious to the public health; but an ordinance permitting burials within that district to an extent greater in number than *376^pTeventsjsajmretrbS~aphAL4-as-a.n..exe.mse of the police power. An ordinance forbidding the burial of human bodies within the city, or upon any designated portion thereof, cannot be sustained, if such burial be permitted upon other lots similarly situated, any more than can an ordinance forbidding the conducting of a soap-boiling factory, or any other occupation which may, under certain circumstances, be deleterious to health; and the owner of lands cannot be restrained from selling them for the purpose of being used as a place of burial, or conducting a soap-boiling factory, or any other use which in the future may become deleterious to health, and for that reason be forbidden, but which is not forbidden at the time of the sale. In Mayor of Hudson v. Thorne, 7 Paige, 261, the city of Hudson, under the power in its charter authorizing it to adopt regulations for the prevention of fires, had passed an ordinance forbidding the erection of any wooden or frame barn, stable, or hay press within certain limits in the city, except of certain dimensions, without permission of the common council, and a resolution by it that such building was not dangerous in causing fires. The defendant, without such permission, commenced the erection of a building within the prohibited limits, which was to be occupied for storing and pressing hay, and a bill to restrain him from erecting the building was dismissed, the chancellor saying: “If the manufacture of pressed hay within the compact parts of the city is dangerous in causing or promoting fires, the common council have the power, expressly given by their charter, to prevent the carrying on of such manufacture; but, as all by-laws must be reasonable, the common council cannot make a by-law which shall permit one person to carry on the dangerous business and prohibit another who has an equal right from pursuing the same business. Neither have they the right to permit the dangerous manufacture to be carried on in buildings already erected, and to prohibit these defendants, whose building was destroyed by an incendiary, from rebuilding the same for *377the purpose of carrying on a manufacture which is permitted to others.” In Tugman v. Chicago, 78 Ill. 405, the city of Chicago had passed an ordinance prohibiting the erection or operation after January 1, 1872, of slaughter-houses within a designated portion of the city, “in any building not now used for such purpose.” It was held by the court that the ordinance was invalid by reason of its discrimination between those owning and operating slaughter-houses prior to 1872, and those erecting arid operating them after that date, upon the ground that an ordinance which would make an act done by one penal, and impose no penalty for the same act done under like circumstances by another, could not be sanctioned or sustained, because it would be unjust and unreasonable, saying:
“ If the health or comfort of the city require the prohibition of new slaughterhouses within a designated part of the city, the same reason would surely demand that old ones should be discontinued. If one of the citizens of Chicago is permitted to engage in the business of slaughtering animals in a certain locality, an ordinance which would prevent, under a penalty, another from engaging in the same business would not only be unreasonable, and for that reason void, but its direct tendency would be to create a monopoly, which the law will not tolerate. The fact that certain persons were engaged in the business within the district designated in the ordinance, at the time of its adoption, gave them no right to monopolize the business, nor would such fact authorize the board of health to provide that such persons might continue the avocation, while others should be deprived of a like privilege, who should engage in the business at a later period. If the board of health had any power to adopt an ordinance on the subject, the ordinance, to be valid, should not discriminate in favor of any citizen. If it prohibited one from carrying on the business, that prohibition should extend to all, regardless of the time the business may have been commenced. A regulation of this character, to be *378binding upon the citizen, must not only be general, but it should be uniform in its operation.”
In Lake View v. Tate, 130 Ill. 247, the municipality had passed an ordinance for the purpose of regulating the speed of railroad trains, and dividing the city into two districts therefor, the east district and the west district, and providing that no train should be run within the limits of the east district at a greater speed than ten miles per hour, making no restriction, however, upon the speed within the other district. It was shown that the route of the Chicago & Evanston Railroad was within the east district, and that of the Chicago and Northwestern Railroad in the west district, and it was held that the ordinance was unreasonable and invalid, for the reason that it constituted a special and unwarranted discrimination between two lawful and competing lines of railway; that as the line of each of the roads ran through a thickly settled portion of the city, with no appreciable difference of danger to those crossing the tracks of the two railways, there was no justification for the discrimination. (See, also, Chicago v. Bumpff, 45 Ill. 90; 92 Am. Dec. 196; State v. Hinman, 65 N. H. 103; 23 Am. St. Rep. 22; State v. Pennoyer, 65 N. H. 113; State v. Mahner, 43 La. Ann. 496; Dillon on Municipal Corporations, sec. 322.)
The ordinance in question forbids the purchase or sale of any parcel of land, if made for the purpose of doing an act thereon which is in itself not only not illegal or forbidden, but is, by the same ordinance, recognized as a legal act,' and is permitted to others. Irrespective of the rule that the motive with which an act is done is not the subject of punishment, unless the act itself is wrong, the act with which the petitioner is charged—the sale of a lot of land—was done in the exercise of one of the rights of an owner, and can be made an offense only in case such act contributed to the 'violation of law. The burial of a human body is the act sought to be prohibited, and, while it may be conceded that if such prohibition had been made by a valid *379ordinance, the burial of a human body within the lot purchased therefor would have been an offense for which the petitioner might have been charged as an aider and abettor, yet, until the offense of such burial has been committed, the sale and purchase of the lot cannot be made the basis of a crime or misdemeanor.
As the ordinance, by its terms as well as by its operation, discriminates in its operation between individuals , simjJbdy-sitHatedTdt is uporvthat ground unreasonable anxLiiivaljff, and the petitioner should be~3ischargS3i
Van Fleet, J., Temple, J., Henshaw, J., and Beatty, 0. J., concurred.