#### John W. HOLDER, Appellant, v. CITY OF ALLENTOWN; Emma Tropiano, Individually and in her official capacity as a Councilwoman of the City of Allentown; Benjamin Howells, Individually and in his official capacity as a Councilman of the City of Allentown; Joseph S. Daddona, Individually and in his official capacity as the Mayor of the City of Allentown; Charles F. Wilson, Individually and in his official capacity *189as the Manager of Personnel and Labor Relations for the City of Allentown; Howard D. Kunik, Individually and in his official capacity formerly as the Director of Administration and Finance of the City of Allentown, Appellees.

No. 92-1358.

United States Court of Appeals, Third Circuit.

Argued Oct. 26, 1992.

Decided March 4, 1993.

*190John D. Lychak (argued), Gross, McGin-ley, LaBarre & Eaton, Allentown, PA, for appellant.

*191Alan M. Black (argued), Black, McCarthy, Eidelman, Feinberg, Anewalt & Kercher, Allentown, PA, for appellees.

Before: GREENBERG, NYGAARD and HIGGINBOTHAM, Circuit Judges.

OPINION OF THE COURT

A. LEON HIGGINBOTHAM, Jr., Circuit Judge.

Between 1976 and 1990, the city of Allentown, Pennsylvania maintained an ordinance requiring city employees to reside within the city. Between 1985 and 1990, appellant John W. Holder was an employee of Allentown but did not reside within the city. In 1990, Holder wrote a letter to the editor of an Allentown newspaper criticizing the residency requirement. One month after publication of the letter, Allentown officials forced Holder to resign allegedly for violating the residency ordinance. The principal issue in this appeal is whether Holder’s amended complaint states a claim that the city of Allentown and its officials retaliated against him for engaging in protected free speech activity. The district court dismissed Holder’s amended complaint, holding that it did not state a claim for violation of his free speech rights. We now reverse and hold that Holder’s amended complaint did state a claim for violation of his rights to freedom of speech.

There are two other issues presented on this appeal; namely whether Allentown’s enforcement of the residency requirement violated Holder’s rights to freedom of association, and whether Allentown’s termination of Holder’s employment violated his rights to due process. Because we affirm the district court’s holding that Holder’s amended complaint did not state a claim for violation of his freedom of association and due process rights, we will not revisit the court’s analysis in dismissing those two claims.

I.

*Factual Background*

In May 1985, Holder began working as a systems analyst for the City of Allentown in its Department of Administration and Finance. At the time, Allentown had in effect a city ordinance establishing a residency requirement for employees of the city. The ordinance provided that employees of the city were to reside in the city within one year from the date of the beginning of their employment and were to continue residing in the city during the course of their employment. The ordinance also provided that employees who violated the residency requirement would be dismissed from city employment.1

From April 1985 until 1990, Holder and his wife resided in the city of Bethlehem, Pennsylvania. Apparently, in 1985 and 1986, during the course of his first year of employment with Allentown, Holder unsuccessfully attempted to find suitable and affordable housing in Allentown. In May 1986, Holder decided to stay in Bethlehem to be closer to his wife’s family who also resided in that city. However, Holder listed his address and telephone number with Allentown’s personnel office as being in Allentown.

In early February 1990, Allentown’s city council voted to retain the residency ordinance. On February 16, 1990, *The Morning Call,*an Allentown newspaper, published a letter to the editor written by Holder, criticizing the council’s decision to retain the ordinance. Holder wrote in part:

> In Allentown, a full and unconditional “equality of rights, opportunity and treatment,” i.e., real democracy does not exist for city employees. This is because the city’s residency ordinance denies *192them the same privilege of unrestricted home ownership enjoyed by all other citizens.

> These council persons [who voted to retain the ordinance] [] have shown outright disregard for the democratic ideals which underlay the very spirit of the Constitution.

> Ironically, the democratic process, which is to serve and uphold democracy above all else, has been used instead to suppress it. No matter how well-meaning, a few elected officials have seen fit to allow democracy to fall beneath the provincial concerns of a city. In their sophistry, they have failed to come to terms with this most crucial consideration: any rule of law in this land that separates citizens from sharing fully in democracy, and which strips them of their dignity as human beings, cannot be morally justified.

Three days later, on February 21, 1990, city council members Emma Tropiano and Benjamin Howells complained to Howard Kunik, the Director of the Department of Administration and Finance, about Holder’s letter to the editor. That same day, Kunik talked to Henry Kolb, Holder’s immediate supervisor. Kunik told Kolb that Holder’s letter could interfere with Kunik’s ability to gain city council approval of the Department’s budget request.

Pursuant to administrative regulations enacted to enforce the residency ordinance, in the event the city’s personnel office receives information that an employee is violating the ordinance, the director of the department where the employee works and the city’s personnel manager conduct a face-to-face interview with the employee. If the employee denies violating the ordinance, the city investigates. If the investigation convinces the city that the employee is indeed violating the ordinance, the employee is immediately suspended without pay and terminated. If, however, at the initial interview the employee admits to violating the ordinance, the employee is given the opportunity to resign, plus a reference recommendation, and up to 30 days to find other employment before being terminated.

On February 26, Kunik and Charles Wilson, the Manager of Personnel and Labor Relations for Allentown, met with Holder and questioned him regarding his residency. Holder refused to confirm or deny that he did not reside in Allentown. Following the interview with Holder, Kunik supposedly contacted the City Solicitor who informed him that Holder’s refusal to confirm or deny violating the residency ordinance “means that he does not live in the city.”

On February 28, Kunik wrote a memorandum to Joseph Daddona, the mayor of Allentown, recommending that Holder be terminated for violating the residency ordinance. In the memo, Kunik outlined the reasons why he believed Holder did not live in Allentown. The Allentown phone number listed in Holder’s personnel file belonged to an Allentown Real Estate agent. The Post Office did not deliver Holder’s mail at the Allentown address. The electricity company had no record of service to Holder at the Allentown address. Holder was not registered to vote in Allentown, and the registrations for his two automobiles carried,a Bethlehem address.

On March 5, Kunik wrote to Holder, stating that based on the February 26 interview, and based on a subsequent investigation, the city had determined that Holder was in violation of the residency ordinance. The letter concluded by informing Holder that he was being suspended without pay effective immediately. On March 9, Wilson, the city’s personnel manager, wrote to Holder, confirming an earlier telephone conversation that Holder would continue working for the city until March 28, 1990. On March 28, Holder resigned his job of systems analyst with the city.

*Procedural Background*

On May 6, 1991, Holder brought this action, pursuant to 42 U.S.C. § 1983, in the district court for the Eastern District of Pennsylvania against the City of Allentown and the following officials of the city in *193their official and individual capacities: Emma Tropiano, Benjamin Howells, Joseph Daddona, Charles Wilson, and Howard Kunik. Holder claimed that defendants had violated his freedom of speech, freedom of association, due process and equal protection rights under the First, Fifth and Fourteenth Amendments of the United States Constitution. Holder requested in the form of relief: reinstatement, compensatory damages, punitive damages against all defendants, including the city of Allentown, and attorneys’ fees.

On April 24, 1991, the district court dismissed Holder’s due process and equal protection claims and struck down Holder’s claim of punitive damages against the city. As to Holder’s remaining freedom of speech and freedom of association claims, the court found that the complaint did not state claims upon which relief could be granted. However, in lieu of dismissal, the court granted Holder leave to file an amended complaint.

On May 6,1991, Holder filed an amended complaint. Holder maintained in his amended complaint that individual defendants, Howells, Tropiano, Kunik, Wilson and Daddona conspired to fire him in retaliation for writing the letter to the editor. According to the amended complaint, during the period from 1985 to 1990, when Holder was employed by Allentown, no other employee had been terminated or forced to resign for violating the residency ordinance. Moreover, the amended complaint maintained that during the period from 1976 to 1990, “officials of the City of Allentown, including Defendant Daddona, have known and/or permitted city employees other than plaintiff, to reside outside the City limits in violation of the residency ordinance.”

Holder asserted three distinct claims in the amended complaint: 1) that defendants violated his freedom of speech rights because he was terminated not for violating the ordinance, but in retaliation for writing a letter to the editor criticizing the city council for retaining the residency ordinance; 2) that defendants violated his freedom of association rights because the residency ordinance itself interfered with his choice concerning his family’s living arrangements by basing his continued employment in the city upon his residence within the city; and 3) that defendants violated his due process rights because defendants deprived him of his freedom of speech and freedom of association rights without following due process requirements established in the residency ordinance itself.

On May 24, 1991, defendants moved to dismiss Holder’s complaint, pursuant to Rule 12(b)(6) of the Federal Rules of Civil Procedure, for failure to state a claim under which relief may be granted. On March 30, 1992, the district court granted defendants’ motion and dismissed Holder’s complaint. In so ruling, the court concluded that defendants had not violated Holder’s free speech rights because “when a city official is carrying out a duty mandated by municipal law, motive in carrying out that duty is irrelevant.” The court also found that defendant had not violated Holder’s freedom of association rights because “not every claim of personal affiliation will give rise to a freedom of association claim.” As to Holder’s due process claim, the court concluded that “the facts alleged by plaintiff in his complaint make clear that defendants fully complied with the procedural requirements of [the residency ordinance].”

Holder now appeals. One final factual note: on July 18, 1990, less than four months after Holder was terminated, the Allentown City Council revoked the residency ordinance.

II.

The district court had subject matter jurisdiction pursuant to 28 U.S.C. § 1331. We have appellate jurisdiction pursuant to 28 U.S.C. § 1291.

Our review of the district court’s dismissal for failure to state a claim is plenary; meaning we apply the same test the district court should have used initially. *Ditri v. Coldwell Banker Residential Affiliates, Inc.,*954 F.2d 869, 871 (3d Cir. *1941992). The test in reviewing a motion to dismiss for failure to state a claim is whether, under any reasonable reading of the pleadings, plaintiff may be entitled to relief. *Colburn v. Upper Darby Township,*838 F.2d 663, 665-666 (3d Cir.1988). Plaintiff may be entitled to relief in the context of a § 1983 claim if the complaint “sufficiently alleges a deprivation of any right secured by the constitution.” *D.R. v. Middle Bucks Area Vocational Technical Sch.,*972 F.2d 1364, 1367 (3d Cir.1992). The complaint will be deemed to allege sufficient facts if it is adequate to "put the proper defendants on notice of the essential elements of plaintiffs’ cause of action.” *District Council 47, AFSCME v. Bradley,*795 F.2d 310, 313 (3d Cir.1986). At all times in reviewing a motion to dismiss, we must “accept as true the factual allegations in the complaint and all reasonable inferences that can be drawn therefrom.” *Markowitz v. Northeast Land Co.,*906 F.2d 100, 103 (3rd Cir.1990).

In this case, the following factual allegations must be accepted as true: On February 16, 1990, Holder wrote a letter to the editor of the *Morning Call,*criticizing the decision of the city council of Allentown to retain the residency ordinance. Three days later, Tropiano and Howells, two council members who had voted to retain the ordinance, called Kunik, the Director of the agency where Holder worked, and complained about the letter. The same day Kunik called Kolb, Holder’s immediate supervisor, and warned Kolb that the city council might not approve the agency’s budget because of the letter. Two days later, Kunik and Wilson confronted Holder about his residing outside of Allentown. That same week, Kunik wrote to Daddona recommending that Holder be fired for violating the residency ordinance. Holder was subsequently forced to resign one month later. Since the enactment of the ordinance in 1976, no city employee other than Holder has been terminated or forced to resign for violating the residency requirement. During Holder’s term of employment, officials of Allentown knew of other employees violating the residency requirement but did not terminate these employees either before or after Holder himself was terminated.

Holder’s argument before the district court and now on appeal is that the above facts state a claim that defendants terminated his employment in retaliation for writing a letter to the editor.

III.

This circuit abides by a straightforward three step process in examining a public employee’s claim of retaliation for engaging in protected activity. First, plaintiff must show that the activity in question was protected. *Czurlanis v. Albanese,*721 F.2d 98, 103 (3d Cir.1983) (citing *Pickering v. Board of Education,*391 U.S. 563, 88 S.Ct. 1731, 20 L.Ed.2d 811 (1968)). Plaintiff must then show that the protected activity “was a substantial factor in the alleged retaliatory action.” *Czurlanis,*721 F.2d at 103 (citing *Mt. Healthy City School District Board of Education v. Doyle,*429 U.S. 274, 97 S.Ct. 568, 50 L.Ed.2d 471 (1977)). Finally, defendant may defeat plaintiff’s claim by “demonstrating that the same action would have taken place even in the absence of the protected conduct.” *Czurlanis,*721 F.2d at 103 (citing *Givhan v. Western Line Consolidated School District,*439 U.S. 410, 99 S.Ct. 693, 58 L.Ed.2d 619 (1979)). Given that this appeal is being decided on the factual allegations of the complaint, we are only concerned with the first two steps.

A.

The first step of the analysis is whether Holder engaged in protected speech activity. In order to find whether a public employee engaged in protected free speech activity, the court must first determine whether the speech can be fairly characterized as constituting speech on a matter of public concern. *Connick v. Myers,*461 U.S. 138, 147, 103 S.Ct. 1684, 1690, 75 L.Ed.2d 708 (1983); *Pickering,*391 U.S. at 568, 88 S.Ct. at 1734; *Zamboni v. Stamler,*847 F.2d 73, 77 (3d Cir.1988); *Czurlanis,*721 F.2d at 103; *Lees v. West Greene School District,*632 F.Supp. 1327, 1330 *195(W.D.Pa.1986). An employee’s speech addresses a matter of public concern when it can be “fairly considered as relating to any matter of political, social, or other concern to the community.” *Connick,*461 U.S. at 146, 103 S.Ct. at 1690; *Johnson v. Lincoln Univ. of Com.,*776 F.2d 443, 451 (3d Cir.1985). Whether the speech can be fairly characterized as relating to any political, social or other concern of the community is determined by its “content, form, and context.” *Connick,*461 U.S. at 147-48, 103 S.Ct. at 1690. The content of the speech may help to characterize it as relating to a matter of social or political concern of the community if, for example, the speaker seeks to “bring to light actual or potential wrongdoing or breach of public trust” on the part of government officials. *Id.*at 148, 103 S.Ct. at 1691. The form and context of the speech may help to characterize it as relating to a matter of social or political concern to the community if, for example, the forum where the speech activity takes place is not confined merely to the public office where the speaker is employed. *Id.*at 148-49,103 S.Ct. at 1690-91.

If the court finds that the employee’s speech constitutes speech on a matter of public concern, the court must then determine whether the interest of the state in promoting the efficiency of the public services it performs through its employees outweighs the interest of the employee in commenting upon matters of public concern. *Id.*at 142, 103 S.Ct. at 1687. The factors relevant in this balancing test are the extent to which the employee’s speech activity disrupts the working of the office, the extent to which the employee threatens the authority of the employer to run the office, and the extent to which the employee uses the public speech activity to resolve an essentially private grievance of the employee. *Id.*at 153, 103 S.Ct. at 1693.2

In the case before us, it is clear that for purposes of determining whether the complaint states a claim upon which relief can be granted, Holder has asserted sufficient facts to show that, in writing the letter to the editor, he was engaging in protected speech activity.

As an initial matter, under the standard established in *Connick,*Holder’s speech in content, form and context touched on a matter of public concern. In content, the letter sought to inform the public of Allentown about what was, in Holder’s view, a breach of public trust on the part of the city council. According to Holder, voting to retain the residency ordinance demonstrated an “outright disregard for the democratic ideals which underlay the very spirit of the Constitution.” One may agree or disagree with Holder’s premise. But the fact remains that Holder sought to express an opinion on a matter concerning public affairs. In *Garrison v. Louisiana,*379 U.S. 64, 74-75, 85 S.Ct. 209, 215-16, 13 L.Ed.2d 125 (1964), the Supreme Court stated that “speech concerning public affairs is more than self-expression, it is the essence of self-government.” Holder’s letter is, at the very least, an example of a citizen practicing the principle of self-government. The form and context of Holder’s letter also help to characterize it as touching on a matter of public concern. Holder wrote an open letter to the editor of one of Allentown’s newspapers in the aftermath of a vote by the city council. This can certainly be interpreted to mean that Holder intended to provoke public debate on the merits of Allentown’s residency requirement. Moreover, the fact that the newspaper printed the letter can be interpreted to mean that the letter was considered newsworthy. Finally, the fact that Holder was fired allegedly because of the letter goes to show that he did indeed provoke some public debate; though certainly not the sort of debate he asked for nor desired. Thé point here is that the First Amendment “was *196fashioned to assure unfettered interchange of ideas for the bringing about of political and social changes desired by the people.” *Roth v. United States,*354 U.S. 476, 484, 77 S.Ct. 1304, 1308, 1 L.Ed.2d 1498 (1957). The form and context of Holder’s letter demonstrates that he may have sought an exchange of ideas among the citizens of Allentown on the issue of the merits of the residency requirement. As such, the letter in content, form and context can be fairly characterized as relating to a matter of public concern.

As far as balancing Holder’s interest in speaking on a matter of public concern with Allentown’s interest in promoting the efficient delivery of its services, it cannot be said at the stage of determining whether the complaint states a claim upon which relief can be granted that Holder's letter interfered with the interest of Allentown in promoting the services it provides though its public employees. Certainly, there is no indication that the letter interfered with the functioning of the Department where Holder worked, nor is there any indication that Holder used a public forum to resolve an essentially private dispute.

B.

The second step in examining a public employee's claim of retaliation for engaging in protected activity is whether the protected activity “was a substantial factor in the alleged retaliatory action.” *Czurlanis,*721 F.2d at 103. In *Mt. Healthy,*the Supreme Court held that when a public employee brings a claim of retaliation for engaging in protected activity, “[t]he constitutional principle at stake is [ ] vindicated if such an employee is placed in no worse a position than if he had not engaged in the conduct.” *Mt. Healthy,*429 U.S. at 285-86, 97 S.Ct. at 575.

Holder maintains in his complaint that in the entire fourteen-year period during which the residency ordinance was in effect, no public employee was fired for violating the residency requirement even though Allentown officials were aware that other city employees resided outside the city. Holder also maintains that officials of Allentown began enforcement proceedings against him for violating the residency requirement a mere three days after his letter to the editor criticizing the ordinance was published in *The Morning Call.*That, for purposes of determining whether the complaint states, a claim upon which relief can be granted, is sufficient to show that Holder’s exercise of his freedom of speech was a substantial factor in officials of Allentown terminating his employment. In other words, Holder’s complaint has made a sufficient showing that he was placed in a worse position for having engaged in protected activity. *Mt. Healthy,*429 U.S. at 285-86, 97 S.Ct. at 575.

IV.

The district court, however, reasoned that, even if Holder’s free speech activity may have played a role in his termination, his complaint still did not state a claim upon which relief could be granted. The court advanced two grounds for this holding. First, according to the court, “[w]hen a city official is carrying out a duty mandated by municipal law, motive in carrying out the duty is irrelevant.” In Holder’s case, his discharge was mandated by Allentown law. Hence, according to the district court, defendants’ conduct was not unconstitutional. Second, the court reasoned that it could not grant relief to Holder inasmuch as, according to the court, his claim was based upon an unlawful act.

There is a certain intuitive logic to the court’s position. What’s more, this intuitive logic is not convincingly disproved by the legal arguments presented, and the cases cited, in the parties’ motions before the district court or in the parties’ briefs before this court. Were we to rely solely on the arguments and precedent the district court had before it, we would not necessarily conclude that the district court’s holding was unsupportable. But our review of the district court’s ruling is plenary and our own research convinces us that, in holding that the motives of Allentown officials for terminating Holder is *197irrelevant, the district court erred on both grounds for its reasoning.

A.

As to the court’s first ground, it has long been established that discriminatory enforcement of a statute, or law by state and local officials is unconstitutional. *Cox v. Louisiana,*379 U.S. 536, 85 S.Ct. 453, 13 L.Ed.2d 471 (1965); *Oyler v. Boles,*368 U.S. 448, 82 S.Ct. 501, 7 L.Ed.2d 446 (1962); *Ah Sin v. Wittman,*198 U.S. 500, 25 S.Ct. 756, 49 L.Ed. 1142 (1905); *Yick Wo v. Hopkins,*118 U.S. 356, 6 S.Ct. 1064, 30 L.Ed. 220 (1886). In *Yick Wo,*the Supreme Court laid down the rule that a law which is “fair on its face and impartial in its appearance” may nonetheless constitute “illegal discrimination between persons” “if it is applied and administered by public authority with an evil eye and an unequal hand.” *Yick Wo,*118 U.S. at 373-374, 6 S.Ct. at 1073. Public officials engage in unconstitutional discriminatory application or administration of a facially impartial law when they seek to enforce the law “on the basis of an unjustifiable standard, such as race, or religion, or some other arbitrary factor,” or when they seek to enforce the law in order “to prevent the exercise of a fundamental right.” *United States v. Schoolcraft,*879 F.2d 64, 68 (3d Cir.), *cert. denied,*493 U.S. 995, 110 S.Ct. 546, 107 L.Ed.2d 543 (1989). The fact that the duty being carried out by state or local officials in applying the law is labeled “mandatory” as opposed to “discretionary” does not in and of itself render irrelevant the potentially unconstitutional motives of such officials. As the Supreme Court has held, a public official may engage “in invidious discrimination among persons or groups either by use of a statute providing a system of broad discretionary licensing power or, ... *the equivalent of such a system by selective enforcement of an extremely broad prohibitory statute. Cox v. Louisiana,*379 U.S. at 557-58, 85 S.Ct. at 466. (emphasis added).

In the present case, the Allentown residency ordinance provided that any employee who violates the residency requirement “shall be dismissed from city employment.” Allegedly based on this language, the district court labeled the ordinance “mandatory” and reasoned that the motives of Allentown officials in carrying out the mandatory duty of firing Holder is irrelevant. By this reasoning the district court must necessarily mean that, even if Holder could prove at trial that Allentown officials fired him simply because he criticized the city council, Holder would still not have a claim of unconstitutional retaliation because the residency ordinance left Allentown officials no choice but to fire him for violating the residency requirement. Conversely, the district court must also mean that had the ordinance provided that any employee who violates the residency requirement *“may*be dismissed from city employment”, then the ordinance would have been labeled “discretionary” and Holder might have had a claim of unconstitutional retaliation against Allentown officials because the residency ordinance would have provided those officials with a choice as to whether to fire Holder.

We need go no further than the factual allegations of Holder’s complaint to prove the fallacy of this reasoning. Holder alleges that in the fourteen-year existence of the residency ordinance no other city employee has been fired for violating the residency ordinance even though Allentown officials knew that city employees resided outside of the city. If Holder’s allegations are correct, then it is pure fiction to insist on labeling the duty carried out by Allentown officials under the ordinance as “mandatory.” And, as Justice Holmes would say, “fiction always is a poor ground for changing substantial rights.” *Haddock v. Haddock,*201 U.S. 562, 630, 26 S.Ct. 525, 552, 50 L.Ed. 867 (1906) (Holmes, J., dissenting). The Allentown ordinance may have been mandatory in theory but it was discretionary in practice. The Supreme Court held in *Cox v. Louisiana,*that a public official may engage in unconstitutional retaliation either by “use of a statute providing a system of broad discretionary licensing power or ... the equivalent of such a system by selective enforcement of an extremely broad prohibitory statute.” *198*Cox,*379 U.S. at 557-558, 85 S.Ct. at 466. If Holder's factual allegations are proven true, then Allentown officials retaliated against him for exercising his rights to freedom of speech, not by the use of a discretionary statue, but by the equivalent of such a system; namely the selective enforcement of a broad mandatory ordinance.

In short, to state flatly that motive in enforcing a mandatory statute is never relevant is to ignore the long established rule of *Yick Wo*that it is unconstitutional for a law which is “fair on its face and impartial in its appearance” to be “applied and administered by public authority with an evil eye and unequal hand.” In *Burt v. City of New York,*156 F.2d 791 (2d Cir.1946), Judge Learned Hand provided an excellent application of that rule. In that case, plaintiff, a registered architect practicing in New York City, sued the city and various officials of the city for violation of his equal protection rights. Plaintiff was required by law to file applications with the city for approval of projects on which plaintiff was working. In his complaint, plaintiff claimed that city officials had “in many instances deliberately misinterpreted and abused their statutory power in order to deny his applications or impose upon him unlawful conditions.” *Burt,*156 F.2d at 791. Even though the officials were required to deny his applications in certain instances, plaintiff claimed that they had used their mandatory enforcement powers selectively against him while “unconditionally approving the applications of other architects, similarly situated.” *Id.*Thus, plaintiff concluded that he was “the victim of purposeful discrimination.” *Id.*The district court dismissed plaintiff’s complaint and he appealed to the Second Circuit. The court of appeals reversed the district court and reinstated plaintiffs complaint. *Id.*at 793.

In his opinion, Judge Hand reasoned that “if a complaint charges.a state officer, not only with deliberately misinterpreting a statute against the plaintiff, but also with purposely singling him out alone for that misinterpretation,” then plaintiff’s complaint may not be dismissed for failure to state a claim upon which relief can be granted. *Id.*at 792. In the architect’s case, Judge Hand did not find it dispositive that the regulations being applied by the defendants were mandatory. In other words, though the duty of city officials may have been mandated by law, their motive in selectively applying that law to plaintiff was indeed relevant in determining whether they had violated plaintiff’s rights to equal protection. *Id.*at 791. According to Judge Hand, plaintiff's complaint stated a claim that city officials had “selected him for [] oppressive measures, unconditionally approving the applications of other architects, similarly situated.” Id.3

Similarly, here Holder maintains in his complaint that he was selected for retaliatory measures allegedly for violating the residency ordinance while others similarly *199situated were unconditionally not subjected to any punitive actions. Accordingly, the motive of Allentown officials in firing him is relevant.

B.

The second ground advanced by the district court in reasoning that the motives of Allentown officials in firing Holder was irrelevant is that “[n]o court will lend its aid to a party who founds his claims for redress upon an illegal act.” In so ruling the court relied on three cases: *The Florida,*101 U.S. 37, 25 L.Ed. 898 (1880); *Dudley v. Stoneman,*653 F.2d 125 (4th Cir.1981); *Suddarth v.. Slane,*539 F.Supp. 612 (W.D.Va.1982). We take it by its reasoning and its reliance on these cases the court meant that, since Holder actually violated the residency ordinance, his claim of unconstitutional retaliation was founded upon an illegal act. Again, the district court erred.

In *The Florida,*the captain of a union vessel captured the rebel vessel “The Florida” while in a Brazilian port under the protection of a Brazilian warship. The union captain brought “The Florida” back to the United States where it was sunk in a collision. The Brazilian government protested the capture of the vessel and demanded reparations from the United States government. The United States officially disavowed the capture of the rebel vessel as an illegal act and the matter was settled amicably between the two governments. The union captain then brought a private action in court to have title to “The Florida” vest in him as a prize of war. The Supreme Court dismissed the claim, finding that the capture of the rebel vessel was an illegal act and that “no court will lend its aid to a party who founds his claim for redress upon an illegal act.” *The Florida,*101 U.S. at 43.

Similarly, both *Dudley*and *Suddarth*involved facts where plaintiffs based their claim upon illegal acts. In *Suddarth,*a state trooper was terminated for engaging in an adulterous love affair with a neighbor in violation of state police regulations. The trooper sued, claiming his termination violated his freedom of association. The court dismissed his claim, finding that his freedom of association claim was based on his adulterous relationship and that such a relationship was itself an illegal act. *Sud-darth,*539 F.Supp. at 616. Finally in *Dudley,*a state investigator was fired for falsifying a report. The investigator sued, claiming that his termination was a violation of the equal protection clause. Specifically, the investigator argued that he had falsified the report at the behest of a supervisor and that the supervisor had promised him that he could keep his job if he falsified the report. The court dismissed his claim, finding that the agreement between the investigator and the supervisor was itself an illegal act. *Dudley,*653 F.2d at 126.

*The Florida, Dudley,*and *Suddarth*all involved cases where there existed no alternative lawful acts upon which plaintiffs could base their claims for relief. For a captain to illegally seize another vessel and then sue to have title in the vessel vest in him is akin to a mugger stealing a wallet and then suing to have title to the wallet vest in him. For an official to agree to falsify a report and then sue to get his job back as consideration for to falsifying a report is akin to two merchants agreeing to illegal price-fixing and then suing to have the contract enforced. For a police official to engage in unlawful adultery and then sue to retain his position on the theory of freedom of association is akin to criminal defendants entering into an unlawful conspiracy and then defending their conspiracy on the theory of freedom of association.4 In all these cases, there are no alternative lawful acts upon which plaintiffs can base their claims for relief.

Obviously, Holder’s case is different. There is an alternative lawful act upon which he based his claim for relief: he engaged in protected free speech activity. The fact that he did violate the residency *200ordinance does not in and of itself dispose of his claim for relief. The question the district court has to resolve is whether Holder was fired for engaging in an unlawful act or whether he was fired in retaliation for engaging in a lawful protected activity.

V.

In conclusion, we do not at this stage rule on the final merits of Holder’s claim. All that we hold is that, taking as we must the factual allegations of the complaint as true, Holder has stated a claim that the city of Allentown and the individual defendant officials terminated his employment in retaliation for Holder exercising his right to freedom of speech under the First Amendment to the United States Constitution. For the foregoing reasons, we will reverse the district court’s dismissal of Holder’s freedom of speech claim, we will affirm the district court’s dismissal of Holder’s freedom of association and due process claims, and we will remand to the district court for proceedings consistent with this opinion.

1

. The Allentown residency ordinance was enacted in 1976. The actual text of the ordinance provided in relevant part:

> All persons who become employed by the City of Allentown at a date following the effective date of this ordinance shall become shall become domiciled within the City of Allentown within a period of one year (12 months) from the date of their employment and must continue to be domiciled within the City of Allentown during their course of employment with the City.

> Any City employee who shall violate the domicile requirement of this ordinance shall be dismissed from City employment.

2

. It is the role of the court in a case alleging retaliatory action which violates the First Amendment to decide not only whether the speech at issue related to a matter of public concern, but also whether the speech activity interferes with the state's interests in promoting the efficiency of the public services it performs through its employees. *Czurlanis,*721 F.2d at 105.

3

. In criminal cases, the *Yick Wo*rule has evolved into the defense of discriminatory prosecution. In this circuit, to establish a defense of discriminatory prosecution the criminal defendant must demonstrate two factors. First, defendant "must provide evidence that persons similarly situated have not been prosecuted.” *United States v. Schoolcraft,*879 F.2d 64, 68 (3d Cir.), *cert. denied,*493 U.S. 995, 110 S.Ct. 546, 107 L.Ed.2d 543 (1989). Second, defendant "must show that the decision to prosecute was made on the basis of an unjustifiable standard, such as race, religion, or some other arbitrary factor, or that the prosecution was intended to prevent [the] exercise of a fundamental right.” *Schoolcraft,*879 F.2d at 68. So, even under mandatory criminal prosecutions the motives of state and local officials may be relevant in determining whether a facially impartial law is being unconstitutionally applied. This provides further support for our holding that motives may be relevant in determining whether a facially impartial mandatory civil statute was applied in an unconstitutionally retaliatory fashion. For a review of other circuits which have adopted the defense of discriminatory prosecution *see Willhauck v. Halpin,*953 F.2d 689 (1st Cir.1991); *United States v. Holmes,*794 F.2d 345 (8th Cir.1986); *United States v. Bohrer,*807 F.2d 159 (10th Cir.1986); *United States v. McMullen,*755 F.2d 65 (6th Cir.1984); *Kuzinich v. County of Santa Clara,*689 F.2d 1345 (9th Cir.1982); *United States v. Grote,*632 F.2d 387 (5th Cir.1980); *United States v. Berrios,*501 F.2d 1207 (2d Cir.1974); *United States v. Bell,*506 F.2d 207 (D.C.Cir.1974); *United States v. Crowthers,*456 F.2d 1074 (4th Cir.1972).

4

. Of course, this court is not at all suggesting ■ that adultery the is equivalent of a criminal conspiracy. We use the analogy only in the context of the facts of *Suddarth v. Slane,*where Virginia determined that it was an unlawful act for a state trooper to engage in adultery.