Mr. Justice Black
delivered the opinion of the Court.
Louisiana statutes provide in general that all seagoing vessels moving between New Orleans and foreign ports must be navigated through the Mississippi River approaches to the port of New Orleans and within it exclusively by pilots who are State officers. New State pilots are appointed by the governor only upon certification of a State Board of River Pilot Commissioners, themselves pilots. Only those who have served a six-month apprenticeship under incumbent pilots and who possess other specific qualifications may be certified to the governor by the board. Appellants here have had at least fifteen years experience in the river, the port, and elsewhere, as pilots of vessels whose pilotage was not governed by the State law in question. Although they possess all the statutory qualifications except that they have not served the requisite six months apprenticeship under Louisiana officer pilots, they have been denied appointment as State pilots. Seeking relief in a Louisiana state court, they alleged that the incumbent pilots, having unfettered discretion under the law in the selection of apprentices, had selected, with occasional exception, only the relatives and friends of incumbents; that the selections were made by electing prospective apprentices into the pilots’ association, which the pilots have formed by authority of State law; that since “membership . . . has been closed ... to all except those having the favor of the pilots” the result is that only their relatives and friends have and can become State pilots. The Supreme Court of Louisiana has held that the pilotage law so administered does not violate the equal protection clause of the Fourteenth Amendment, 209 La. 737, 25 So. 2d 527. The case is here on appeal from that decision under 28 U. S. C. § 344 (a).
The constitutional command for a state to afford “equal protection of the laws” sets a goal not attainable by the invention and application of a precise formula. This Court has never attempted that impossible task. A law which affects the activities of some groups differently from the way in which it affects the activities of other groups is not necessarily banned by the Fourteenth Amendment. See e. g., Tigner v. Texas, 310 U. S. 141, 147. Otherwise, effective regulation in the public interest could not be provided, however essential that regulation might be. For it is axiomatic that the consequence of regulating by setting apart a classified group is that those in it will be subject to some restrictions or receive certain advantages that do not apply to other groups or to all the public. Atchison, T. & S. F. R. Co. v. Matthews, 174 U. S. 96, 106. This selective application of a regulation is discrimination in the broad sense, but it may or may not deny equal protection of the laws. Clearly, it might offend that constitutional safeguard if it rested on grounds wholly irrelevant to achievement of the regulation’s objectives. An example would be a law applied to deny a person a right to earn a living or hold any job because of hostility to his particular race, religion, beliefs, or because of any other reason having no rational relation to the regulated activities. See American Sugar Rfg. Co. v. Louisiana, 179 U. S. 89, 92.
The case of Yick Wo v. Hopkins, 118 U. S. 356, relied on by appellants, is an illustration of a type of discrimination which is incompatible with any fair conception of equal protection of the laws. Yick Wo was denied the right to engage in an occupation supposedly open to all who could conduct their business in accordance with the law’s requirements. He could meet these requirements, but was denied the right to do so solely because he was Chinese. And it made no difference that under the law as written Yick Wo would have enjoyed the same protection as all others. Its unequal application to Yick Wo was enough to condemn it. But Yick Wo’s case, as other cases have demonstrated, was tested by the language of the law there considered and the administration there shown. Cf. Crowley v. Christensen, 137 U. S. 86, 93, 94; Gundling v. Chicago, 177 U. S. 183; New York ex rel. Lieberman v. Van de Carr, 199 U. S. 552; Engel v. O’Malley, 219 U. S. 128, 137. So here, we must consider the relationship of the method of appointing pilots to the broad objectives of the entire Louisiana pilotage law. See Grainger v. Douglas Park Jockey Club, 148 F. 513, and cases there cited. In so doing we must view the appointment system in the context of the historical evolution of the laws and institution of pilotage in Louisiana and elsewhere. Cf. Otis Co. v. Ludlow Mfg. Co., 201 U. S. 140, 154; Jackman v. Rosenbaum, 260 U. S. 22, 31; Bayside Fish Flour Co. v. Gentry, 297 U. S. 422, 428-430. And an important factor in our consideration is that this case tests the right and power of a state to select its own agents and officers. Taylor v. Beckham, 178 U. S. 548; Snowden v. Hughes, 321 U. S. 1, 11-13.
Studies of the long history of pilotage reveal that it is a unique institution and must be judged as such. In order to avoid invisible hazards, vessels approaching and leaving ports must be conducted from and to open waters by persons intimately familiar with the local waters. The pilot’s job generally requires that he go outside the harbor’s entrance in a small boat to meet incoming ships, board them and direct their course from open water to the port. The same service is performed for vessels leaving the port. Pilots are thus indispensable cogs in the transportation system of every maritime economy. Their work prevents traffic congestion and accidents which would impair navigation in and to the ports. It affects the safety of lives and cargo, the cost and time expended in port calls, and, in some measure, the competitive attractiveness of particular ports. Thus, for the same reasons that governments of most maritime communities have subsidized, regulated, or have themselves operated docks and other harbor facilities and sought to improve the approaches to their ports, they have closely regulated and often operated their ports’ pilotage systems.
The history and practice of pilotage demonstrate that, although inextricably geared to a complex commercial economy, it is also a highly personalized calling. A pilot does not require a formalized technical education so much as a detailed and extremely intimate, almost intuitive, knowledge of the weather, waterways and conformation of the harbor or river which he serves. This seems to be particularly true of the approaches to New Orleans through the treacherous and shifting channel of the Mississippi River. Moreover, harbor entrances where pilots can most conveniently make their homes and still be close to places where they board incoming and leave outgoing ships are usually some distance from the port cities they serve. These “pilot towns” have begun, and generally exist today, as small communities of pilots, perhaps near but usually distinct from the port cities. In these communities young men have an opportunity to acquire special knowledge of the weather and water hazards of the locality and seem to grow up with ambitions to become pilots in the traditions of their fathers, relatives, and neighbors. We are asked, in effect, to say that Louisiana is without constitutional authority to conclude that apprenticeship under persons specially interested in a pilot’s future is the best way to fit him for duty as a pilot officer in the service of the State.
The States have had full power to regulate pilotage of certain kinds of vessels since 1789 when the first Congress decided that then existing state pilot laws were satisfactory and made federal regulation unnecessary. 1 Stat. 53, 54 (1789), 46 U. S. C. § 211; Olseny. Smith, 195 U. S. 332, 341; Anderson v. Pacific Coast S. S. Co., 225 U. S. 187. Louisiana legislation has controlled the activities and appointment of pilots since 1805—even before the Territory was admitted as a State. The State pilotage system, as it has evolved since 1805, is typical of that which grew up in most seaboard states and in foreign countries. Since 1805 Louisiana pilots have been State officers whose work has been controlled by the State. That Act forbade all but a limited number of pilots appointed by the governor to serve in that capacity. The pilots so appointed were authorized to select their own deputies. But pilots, and through them, their deputies, were literally under the command of the master and the wardens of the port of New Orleans, appointed by the governor. The master and wardens were authorized to make rules governing the practices of pilots, specifically empowered to order pilots to their stations, and to fine them for disobedience to orders or rules. And the pilots were required to make official bond for faithful performance of their duty. Pilots’ fees were fixed; ships coming to the Mississippi were required to pay pilotage whether they took on pilots or not. The pilots were authorized to organize an association whose membership they controlled in order “to enforce the legal regulations, and add to the efficiency of the service required thereby.” Moreover, efficient and adequate service was sought to be insured by requiring the Board of Pilot Commissioners to report to the governor and authorizing him summarily to remove any pilot guilty of “neglect of duty, habitual intemperance, carelessness, incompetency, or any act or conduct . . . showing” that he “ought to be removed.” La. Act No. 113, § 20 (1857). These provisions have been carried over with some revision into the present comprehensive Louisiana pilotage law. 6 La. Gen. Stat., tit. 59, cc. 6, 8 (1939). Thus in Louisiana, as elsewhere, it seems to have been accepted at an early date that in pilotage, unlike other occupations, competition for appointment, for the opportunity to serve particular ships and for fees, adversely affects the public interest in pilotage.
It is within the framework of this long-standing pilotage regulation system that the practice has apparently existed of permitting pilots, if they choose, to select their relatives and friends as the only ones ultimately eligible for appointment as pilots by the governor. Many other states have established pilotage systems which make the selection of pilots on this basis possible. Thus it was noted thirty years ago in a Department of Commerce study of pilotage that membership of pilot associations “is limited to persons agreeable to those already members, generally relatives and friends of the pilots. Probably in pilotage more than in any other occupation in the United States the male members of a family follow the same work from generation to generation.”
The practice of nepotism in appointing public servants has been a subject of controversy in this country throughout our history. Some states have adopted constitutional amendments or statutes to prohibit it. These have reflected state policies to wipe out the practice. But Louisiana and most other states have adopted no such general policy. We can only assume that the Louisiana legislature weighed the obvious possibility of evil against whatever useful function a closely knit pilotage system may serve. Thus the advantages of early experience under friendly supervision in the locality of the pilot’s training, the benefits to morale and esprit de corps which family and neighborly tradition might contribute, the close association in which pilots must work and live in their pilot communities and on the water, and the discipline and regulation which is imposed to assure the State competent pilot service after appointment, might have prompted the legislature to permit Louisiana pilot officers to select those with whom they would serve.
The number of people, as a practical matter, who can be pilots is very limited. No matter what system of selection is adopted, all but the few occasionally selected must of necessity be excluded. Cf. Olsen v. Smith, supra, 344, 345. We are aware of no decision of this Court holding that the Constitution requires a state governor, or subordinates responsible to him and removable by him for cause, to select state public servants by competitive tests or by any other particular method of selection. The object of the entire pilotage law, as we have pointed out, is to secure for the State and others interested the safest and most efficiently operated pilotage system practicable. We cannot say that the method adopted in Louisiana for the selection of pilots is unrelated to this objective. See Olsen v. Smith, supra; cf. Carmichael v. Southern Coal Co., 301 U. S. 495, 509-510. We do not need to consider hypothetical questions concerning any similar system of selection which might conceivably be practiced in other professions or businesses regulated or operated by state governments. It is enough here that considering the entirely unique institution of pilotage in the light of its history in Louisiana, we cannot say that the practice appellants attack is the kind of discrimination which violates the equal protection clause of the Fourteenth Amendment.
Affirmed.
A ship entering the Mississippi River from the Gulf of Mexico is piloted the twenty mile distance from the mouth of the river to “Pilot Town” by one of a group of pilots specially familiar with the “entrance” to the Mississippi through the so-called “passes.” La. Acts 1880, No. 99, § 2, La. Acts 1908, No. 55, § 1, La. Acts 1910, No. 26, § 1, 6 La. Gen. Stat. §§ 9141, 9163 (1939). Between Pilot Town and New Orleans, a distance of approximately ninety miles, ships are piloted exclusively by so-called river port pilots. La. Acts 1908, No. 54, § 1, 6 La. Gen. Stat., tit. 59, c. 8 (1939). By an amendment in 1942 the exclusive jurisdiction of the river port pilots was extended to the piloting of seagoing vessels within the port of New Orleans. La. Acts 1942, No. 134, 6 La. Gen. Stat. § 9155 (Supp. 1946). Appellants here sought appointment as river port pilots.
Sections 2 and 3 of the Act of 1908 provided for the appointment and commissioning of twenty-eight pilots by the governor and prescribed that thereafter there should not be less than twenty. 6 La. Gen. Stat. §§ 9155, 9156 (1939).
The statement of the Louisiana court in this case that pilots so appointed are considered State officers has long been the established State rule. Williams v. Payson, 14 La. Ann. Rep. 7, 8 (1859); Louisiana v. Follett, 33 La. Ann. Rep. 228, 230 (1881); Levine v. Michel, 35 La. Ann. Rep. 1121, 1124 (1883).
From among the pilots the governor was required to appoint three River Port Pilot Commissioners. La. Acts 1908, No. 54, § 1, 6 La. Gen. Stat. § 9154 (1939).
“Whenever there exists a necessity for more pilots . . . the . . . board of river port pilot commissioners shall hold examinations, under such rules and regulations, and with such requirements as they shall have provided, with the governor’s approval, provided that no applicant shall be considered by said board, unless he submits proper evidence of moral character and is a voter of this state, and shall have served six months’ apprenticeship in his proposed calling, and upon the certificate of the board to the governor that the applicant has complied with the provisions of this act, the governor may, in his discretion, appoint to existing vacancies.” La. Acts 1908, No. 54, § 4. 6 La. Gen. Stat. § 9157 (1939).
Appellants were licensed to pilot coastwise vessels to and through the port under federal law which excludes states from controlling pilotage of coastal shipping. Rev. Stat. §§ 4401, 4444, 46 U. S. C. §§ 215, 364. Also prior to the passage of La. Acts 1942, No. 134, they had piloted all classes of vessels within the port of New Orleans. That Act deprived appellants of authority to pilot within the port and conferred it exclusively upon State river port pilots. Thus appellants allege they have been deprived of an opportunity to make a living unless they can obtain appointment as river port pilots under the pilotage law.
While the Act does not specifically require that the apprenticeships be performed under incumbent officer pilots, the State Supreme Court has so construed it.
La. Rev. Stat. § 2707 (1869), reenacted in § 4 of La. Acts 1928, No. 198, 6 La. Gen. Stat. § 9149 (1939).
Appellants’ complaint was dismissed for failure to state a cause of action. Therefore we consider their allegations as facts for the purpose of this decision.
Appellants’ prayer had sought an injunction against interference with their serving as pilots, and, in the alternative, sought mandamus to compel the Board to examine appellants as required by law and to certify them to the Governor. The Louisiana Supreme Court affirmed the trial court’s refusal to compel the board to examine appellants because they did not possess the qualifications required to take examinations—specifically, they had not served apprenticeships.
See generally, Report of Departmental Committee on Pilotage (London, 1911); Pilotage in the United States, Special Agents Series, Department of Commerce (1917).
See Cooley v. Board of Wardens, 12 How. 299, 308, 312, 316, 326; Ex parte McNiel, 13 Wall. 236, 238, 239.
For an excellent description of a pilot’s life and duty, see Kane, Deep Delta Country, c. 10 (1944).
See Kane, op. cit. supra, note 10. See also Hearings before House Committee on the Merchant Marine and Fisheries on H. R. 9678, 64th Cong., 1st Sess., 106, 214, 229, 279 (1916) (compulsory barge pilotage).
See Giesecke, American Commercial Legislation before 1789 (1910) 118; Kane, op. cit. supra, note 10.
See Kane, op. cit. supra, note 10. A Louisiana statute provides that “no license shall be granted any person to keep a tavern . . . at the Balize, South West Pass or any other station for pilots, nor within three miles of such station, unless the person applying for such license shall be recommended in writing by a majority of the branch pilots.” La. Rev. Stat. § 2704 (1869), 6 La. Gen. Stat. § 9166 (1939).
See Kane op. cit. supra, note 10, 128; see also Pilotage in the United States, op. cit. supra, note 8, 8, 16.
La. Acts (Territory of New Orleans) 1805, c. 24; see also Surrey, Commerce of Louisiana, 1699-1763, a. III (1916).
Almost all the maritime states, some as colonies before the Revolution, adopted comprehensive pilotage laws which included unrestricted apprenticeship provisions. Mass. Laws, c. 13 (1783); Mass. Rev. Stat. c. 32, §§ 5-42 (1836); New York Laws, c. XVIII, §§ I, VII, X, XII (1819); Pa. Stats, at Large, c. 536, § VI (1767); N. J. Rev. Laws, tit. 37, c. 7, § 18 (1847); 1 Laws of Md. (Dorsey) c. 63, §§ 2, 20, 23 (1803); Code of Virginia, c. 92, §§ 4, 9 (1849); N. C. Rev. Stat. c. 88, §§ 1, 5, 14 (1837). See also Report of Departmental Committee on Pilotage, op. cit. supra, note 8, Part I.
See note 2 supra.
The 1805 Act required deputies to obtain a certificate from the master and wardens as a condition precedent to their appointment. But § 1 of La. Acts 1806, c. 26, gave pilots blanket authority to appoint their own deputies. Pilots were, however, made responsible for the neglect or misconduct of their deputies.
La. Acts 1805, c. 24, § 20; La. Acts 1837, No. 106, § 9.
La. Acts 1805, c. 24, § 17.
Levine v. Michel, supra, at 1125; see also note 6 supra.
See Kane, op. cit. supra, n. 10, at 126-128; all of the State and colonial statutes set out in note 10, supra, provided for limitation on the number of pilots and fixed the fees they might charge. This is generally true today. See n. 23 infra.
The Department of Commerce Report, supra, n. 8, at 28 observed that: “The formation of pilots' associations was largely a result of the intense competition that formerly prevailed among the pilots, .... Little effort was made to maintain definite pilot stations. Instead, the desire to be the first to speak a ship frequently led the pilots to cruise great distances from the port.
“One of the unfortunate results of the intense competition of pilots was the fact that frequently pilots could not be had when wanted, although they might be far out to sea in quest of business. Another drawback was that pilots unnecessarily exposed themselves to danger. And a third important disadvantage was that it made the earnings precarious; a pilot might earn a great deal this month and very little the next. . . .
“The pilots themselves were the first to see the disadvantages of the free or competitive system and to take steps toward the organization of associations. These associations soon developed into strong working combinations that eliminated competition and placed on an amicable basis matters that formerly produced much sharp rivalry.
“From the evidence at hand it would appear that the shipping interests as well as the insurance and commercial interests of the ports encouraged the pilots in the formation of these associations. The advantages of a well-organized pilotage system were as apparent to these interests as to the pilots themselves, for the commerce of the port was not only facilitated and expedited but made much safer by reason of the better organization of the pilotage system, which came with the elimination of competition.
“Since associations have been formed along the present lines pilot-age grounds have been established . . . These grounds are well known to mariners, who may safely count on finding there at practically all times and in all conditions of weather a pilot boat with a sufficient number of pilots aboard to accommodate any reasonable number of vessels that may come. There is little chance nowadays that a vessel will fail to find a pilot when needed. . . .
“Still another advantage of the present organization of pilotage systems is that it permits the maintenance of a central office which is in constant touch with the pilot boat and arranges for the rotation of pilots. The association generally employs an agent to look after the routine business of the office.”
See N. J. Laws 1898, c. 31, N. J. Stat. Ann. Title 12, c. 8 (1939); Pa. P. L. 542 of 1803, Pa. Stats. Ann. (Purdon) Title 55, c. 2 (1930); Md. Ann. Code (Flack), Art. 74 (1939); Del. Rev. Code, c. 35 (1935); Va. Code, c. 142 (1942); Ala. Laws, 1931, p. 154, Ala. Code, Title 38, c. 2 (1940); Ore. Comp. Laws Ann., Title 105, c. 2 (1940). See also note 16, supra.
Pilotage in the United States, supra, note 8, p. 8.
See e. g., Mo. Const., Art. 14, § 13 (1924).
See e. g., Idaho Sess. Laws, 1915, c. 10, Idaho Code Ann., § 57-701 (1932); Fla. Laws, 1933, c. 16088, Fla. Stats. Ann. §§ 116.10, 116.11 (1943); Neb. Laws 1919, c. 190, § 6, Neb. Rev. Stat. § 81-108 (1943); Tex. Acts 1909, p. 85, Tex. Penal Code (Vernon) Arts. 432-438 (1938).
In Olsen v. Smith, the constitutionality of a Texas statute forbidding all but pilots appointed by the governor to serve was challenged by one who had not been appointed and had been enjoined from serving as a pilot. Yick Wo v. Hopkins, supra, was relied on as authority for a contention that he had been denied rights protected by the Fourteenth Amendment including equal protection of the laws. Id. 334. But this Court in sustaining the constitutionality of the statute, did not specifically discuss the question here raised. Therefore we do not depend upon Olsen v. Smith as a necessarily controlling authority for our decision here.