delivered the opinion of the Court.
In 1941 the California Legislature amended the Charter of the City of Los Angeles to provide in part as follows:
“. . . no person shall hold or retain or be eligible for any public office or employment in the service *718of the City of Los Angeles, in any office or department thereof, either elective or appointive, who has within five (5) years prior to the effective date of this section advised, advocated or taught, or who may, after this section becomes effective [April 28, 1941], advise, advocate or teach, or who is now or has been within five (5) years prior to the effective date of this section, or who may, after this section becomes effective, become a member of or affiliated with any group, society, association, organization or party which advises, advocates or teaches, or has, within said period of five (5) years, advised, advocated or taught the overthrow by force or violence of the government of the United States of America or of the State of California.
“In so far as this section may be held by any court of competent jurisdiction not to be self-executing, the City Council is hereby given power and authority to adopt appropriate legislation for the purpose of effectuating the objects hereof.” Cal. Stat. 1941, c. 67.
Pursuant to the authority thus conferred, the City of Los Angeles in 1948 passed Ordinance No. 94,004, requiring every person who held an office or position in the service of the city to take an oath prior to January 6, 1949. In relevant part the oath was as follows:
“I further swear (or affirm) that I do not advise, advocate or teach, and have not within the period beginning five (5) years prior to the effective date of the ordinance requiring the making of this oath or affirmation, advised, advocated or taught, the overthrow by force, violence or other unlawful means, of the Government of the United States of America or of the State of California and that I am not now and have not, within said period, been or become a mem*719ber of or affiliated with any group, society, association, organization or party which advises, advocates or teaches, or has, within said period, advised, advocated or taught, the overthrow by force, violence or other unlawful means of the Government of the United States of America, or of the State of California. I further swear (or affirm) that I will not, while I am in the service of the City of Los Angeles, advise, advocate or teach, or be or become a member of or affiliated with any group, association, society, organization or party which advises, advocates or teaches, or has within said period, advised, advocated or taught, the overthrow by force, violence or other unlawful means, of the Government of the United States of America or of the State of California . . . .”
The ordinance also required every employee to execute an affidavit “stating whether or not he is or ever was a member of the Communist Party of the United States of America or of the Communist Political Association, and if he is or was such a member, stating the dates when he became, and the periods during which he was, such a member . . . .”
On the final date for filing of the oath and affidavit petitioners were civil service employees of the City of Los Angeles. Petitioners Pacifico and Schwartz took the oath but refused to execute the affidavit. The remaining fifteen petitioners refused to do either. All were discharged for such cause, after administrative hearing, as of January 6,1949. In this action they sue for reinstatement and unpaid salaries. The District Court of Appeal denied relief. 98 Cal. App. 2d 493, 220 P. 2d 958 (1950). We granted certiorari, 340 U. S. 941 (1951).
Petitioners attack the ordinance as violative of the provision of Art. I, § 10 of the Federal Constitution that “No State shall . . . pass any Bill of Attainder, [or] ex post facto Law . . . .” They also contend that the ordinance *720deprives them of freedom of speech and assembly and of the right to petition for redress of grievances.
Petitioners have assumed that the oath and affidavit provisions of the ordinance present similar constitutional considerations and stand or fall together. We think, however, that separate disposition is indicated.
1. The affidavit raises the issue whether the City of Los Angeles is constitutionally forbidden to require that its employees disclose their past or present membership in the Communist Party or the Communist Political Association. Not before us is the question whether the city may determine that an employee’s disclosure of such political affiliation justifies his discharge.
We think that a municipal employer is not disabled because it is an agency of the State from inquiring of its employees as to matters that may prove relevant to their fitness and suitability for the public service. Past conduct may well relate to present fitness; past loyalty may have a reasonable relationship to present and future trust. Both are commonly inquired into in determining fitness for both high and low positions in private industry and are not less relevant in public employment. The affidavit requirement is valid.
2. In our view the validity of the oath turns upon the nature of the Charter amendment (1941) and the relation of the ordinance (1948) to this amendment. Immaterial here is any opinion we might have as to the Charter provision insofar as it purported to apply retrospectively for a five-year period prior to its effective date. We assume that under the Federal Constitution the Charter amendment is valid to the extent that it bars from the city’s public service persons who, subsequent to its adoption in 1941, advise, advocate, or teach the violent overthrow of the Government or who are or become affiliated with any group doing so. The provisions operating thus prospectively were a reasonable regulation *721to protect the municipal service by establishing an employment qualification of loyalty to the State and the United States. Cf. Gerende v. Board of Supervisors of Elections, 341 U. S. 56 (1951). Likewise, as a regulation of political activity of municipal employees, the amendment was reasonably designed to protect the integrity and competency of the service. This Court has held that Congress may reasonably restrict the political activity of federal civil service employees for such a purpose, United Public Workers v. Mitchell, 330 U. S. 75, 102-103 (1947), and a State is not without power to do as much.
The Charter amendment defined standards of eligibility for employees and specifically denied city employment to those persons who thereafter should not comply with these standards. While the amendment deprived no one of employment with or without trial, yet from its effective date it terminated any privilege to work for the city in the case of persons who thereafter engaged in the activity proscribed.
The ordinance provided for administrative implementation of the provisions of the Charter amendment. The oath imposed by the ordinance proscribed to employees activity which had been denied them in identical terms and with identical sanctions in the Charter provision effective in 1941. The five-year period provided by the oath extended back only to 1943.
The ordinance would be ex post facto if it imposed punishment for past conduct lawful at the time it was engaged in. Passing for the moment the question whether separation of petitioners from their employment must be considered as punishment, the ordinance clearly is not ex post facto. The activity covered by the oath had been proscribed by the Charter in the same terms, for the same purpose, and to the same effect over seven years before, and two years prior to the period embraced in the oath. Not the law but the fact was posterior.
*722Bills of attainder are “legislative acts . . . that apply either to named individuals or to easily ascertainable members of a group in such a way as to inflict punishment on them without a judicial trial . . . .” United States v. Lovett, 328 U. S. 303, 315 (1946). Punishment is a prerequisite. See concurring opinion in Lovett, supra, at 318, 324. Whether legislative action curtailing a privilege previously enjoyed amounts to punishment depends upon “the circumstances attending and the causes of the deprivation.” Cummings v. Missouri, 4 Wall. 277, 320 (1867). We are unable to conclude that punishment is imposed by a general regulation which merely provides standards of qualification and eligibility for employment.
Cummings v. Missouri, 4 Wall. 277 (1867), and Ex parte Garland, 4 Wall. 333 (1867), the leading cases in this Court applying the federal constitutional prohibitions against bills of attainder, recognized that the guarantees against such legislation were not intended to preclude legislative definition of standards of qualification for public or professional employment. Carefully distinguishing an instance of legislative “infliction of punishment” from the exercise of “the power of Congress to prescribe qualifications,” the Court said in Garland’s case: “The legislature may undoubtedly prescribe qualifications for the office, to which he must conform, as it may, where it has exclusive jurisdiction, prescribe qualifications for the pursuit of any of the ordinary avocations of life.” 4 Wall, at 379-380. See also, Cummings v. Missouri, supra, at 318-319. This doctrine was reaffirmed in Dent v. West Virginia, 129 U. S. 114 (1889), in which Mr. Justice Field, who had written the Cummings and Garland opinions, wrote for a unanimous Court upholding a statute elevating standards of qualification to practice medicine. And in Hawker v. New York, 170 U. S. 189 (1898), the Court upheld a statute forbidding *723the practice of medicine by any person who had been convicted of a felony. Both Dent and Hawker distinguished the Cummings and Garland cases as inapplicable when the legislature establishes reasonable qualifications for a vocational pursuit with the necessary effect of disqualifying some persons presently engaged in it.
Petitioners rely heavily upon United States v. Lovett, 328 U. S. 303 (1946), in which a legislative act effectively separating certain public servants from their positions was held to be a bill of attainder. Unlike the provisions of the Charter and ordinance under which petitioners were removed, the statute in the Lovett case did not declare general and prospectively operative standards of qualification and eligibility for public employment. Rather, by its terms it prohibited any further payment of compensation to named individual employees. Under these circumstances, viewed against the legislative background, the statute was held to have imposed penalties without judicial trial.
Nor are we impressed by the contention that the oath denies due process because its negation is not limited to affiliations with organizations known to the employee to be in the proscribed class. We have no reason to suppose that the oath is or will be construed by the City of Los Angeles or by California courts as affecting adversely those persons who during their affiliation with a proscribed organization were innocent of its purpose, or those who severed their relations with any such organization when its character became apparent, or those who were affiliated with organizations which at one time or another during the period covered by the ordinance were engaged in proscribed activity but not at the time of affiant’s affiliation.* *724We assume that scienter is implicit in each clause of the oath. As the city has done nothing to negative this interpretation, we take for granted that the ordinance will be so read to avoid raising difficult constitutional problems which any other application would present. Fox v. Washington, 236 U. S. 273, 277 (1915). It appears from correspondence of record between the city and petitioners that although the city welcomed inquiry as to its construction of the oath, the interpretation upon which we have proceeded may not have been explicitly called to the attention of petitioners before their refusal. We assume that, if our interpretation of the oath is correct, the City of Los Angeles will give those petitioners who heretofore refused to take the oath an opportunity to take it as interpreted and resume their employment.
The judgment as to Pacifico and Schwartz is affirmed. The judgment as to the remaining petitioners is affirmed on the basis of the interpretation of the ordinance which we have felt justified in assuming.
Affirmed.
In interpreting local legislation proscribing affiliation with defective organizations, the Supreme Court of California has gone beyond the literal text of a statute so as to require knowledge of the character of the organization, as of the time of affiliation, by the person *724whose affiliation is in question. In People v. Steelik, 187 Cal. 361, 203 P. 78 (1921), the Court upheld a conviction under the Criminal Syndicalism Act of 1919 which made one guilty of a felony who “is” a member of any one of a certain class of proscribed organizations. The indictment in relevant part alleged that defendants “are and each of them is” a member of a proscribed organization. The court interpreted the statute as defining and the indictment as charging “the offense of criminal syndicalism in that he knowingly belonged” to a proscribed organization. (Emphasis added.) 187 Cal. at 376, 203 P. at 84.