
    Robert F. ESPY, Jr., George Rogers, Ed Krol, Herb Dittrich, Bill Lipchak, Edward Trapp, Timothy Evans, Emsworth Police Wage and Policy Committee, Appellants, v. BOROUGH OF EMSWORTH, Andrew Pulkowski, Mayor, Ron Lawry, President of Council, Jane Haney-Gruber, Richard Hays, Jennie Knox, John Manko, Ed Politylo, Michael Simmeth, Members of Council.
    Commonwealth Court of Pennsylvania'.
    Argued Nov. 19, 1993.
    Decided Jan. 12, 1994.
    Reargument Denied Feb. 28, 1994.
    Ronald P. Koemer, for appellants.
    Martín F.P. Vinci, III, for appellees.
    Before CRAIG, President Judge, McGINLEY, J., and NARICK, Senior Judge.
   NARICK, Senior Judge.

Before us is an appeal from an order sustaining the preliminary objections of the Borough of Emsworth, the Mayor, and the members of the Borough Council of Emsworth (Borough) to a complaint in mandamus filed by Robert F. Espy, Jr. and other former Emsworth police officers and the Emsworth Police Wage and Policy Committee, which is the elected representative of all the police officers of Emsworth (Appellants).

Appellant Officers were employed by the Borough of Emsworth and worked as regular full-time police officers until December 31, 1992. On November 20, 1992, the Borough Council entered into a contract with Ohio Township to provide police services for the Borough of Emsworth by using Ohio Township officers. Effective December 31, 1992, the Emsworth police department was disbanded.

Subsequently, Appellants filed the present mandamus action claiming that Section 46190 of The Borough Code imposes a mandatory duty on Appellees to reinstate the police officers in the order of their seniority. They allege that the Borough, in hiring the Ohio Township police officers to perform the identical duties of the Emsworth officers, violated their duty under this section of the Borough Code, and have acted in bad faith in attempting to circumvent and undermine the civil service statutes designed to protect the police officers of the Commonwealth.

The Borough filed preliminary objections in the nature of a demurrer to the complaint in mandamus. The trial court held that Ap-pellees have a duty under the Borough Code to reinstate the police officers only when there is a reduction in the police force, and not where the Borough has contracted with another municipality for protection and has ceased operating its own police department. The trial court therefore held that Appellants’ complaint, “failed to set forth a factual matrix upon which relief could be founded,” (Opinion at 4, April 14, 1993), and it dismissed the complaint.

The Borough argues that it is clearly authorized to abolish its police force and to enter into a contract with a near or adjacent municipality to receive police protection pursuant to Sections 46006(3) and 46202(35) of the Borough Code. Moreover, it claims that the civil service statutes which, “insure the continuance in office of individuals who are faithful and conscientious in the discharge of their duties ...,” Appeal of Gagliardi, 401 Pa. 141, 163 A.2d 418 (1960), do not apply when the office or department is abolished for economic reasons. Therefore the Borough has no duty to re-hire Appellant Officers. Myers Appeal, 33 Pa.Commonwealth Ct. 430, 382 A.2d 145 (1978).

Appellants alleged in their complaint not only that the Borough had a duty to rehire them, but that it had acted in bad faith in hiring Ohio Township police to exercise the identical police duties in Emsworth Borough previously exercised by the members of the Emsworth Police Department. Appellants claim that the Borough entered into this contract in order to avoid rehiring Appellant Officers and to circumvent the civil service laws.

For the purpose of testing the legal sufficiency of the challenged pleading, preliminary objections in the nature of a demurrer admit as true all well-pleaded, material, relevant facts and every reasonable inference from those facts. A demurrer will only be sustained where the complaint is clearly insufficient to establish a right to relief. County of Allegheny v. Commonwealth, 507 Pa. 360, 490 A.2d 402 (1985). We hold that Appellants’ allegations state a claim upon which relief may be granted.

It is established law that where there is affirmative evidence of a municipality’s bad faith and that the abolition of an office or department is merely a pretense, a court may invalidate the municipality’s action and order reinstatement of the discharged employees. Thus, the Pennsylvania Supreme Court has upheld writs of mandamus granted by the trial court where there was sufficient evidence that the abolition of a police officer’s job or an entire police department was a pretext or a subterfuge which was meant to circumvent and undermine the purposes of the civil service laws. Township of Perkiomen v. Mest, 513 Pa. 598, 522 A.2d 516 (1987); Schauer v. Whitehall Borough, 413 Pa. 6, 194 A.2d 318 (1963); Schearer v. Reading, 346 Pa. 27, 28 A.2d 790 (1942); Mack v. Hoover, 342 Pa. 291, 20 A.2d 757 (1941).

Here, Appellants have not had the opportunity to prove their allegation that the Borough’s abolition of the department was a pretext for circumventing the civil service laws because the Borough’s preliminary objections to this action in mandamus were granted. This we hold was error. Appellants should have been given the chance to develop a factual record in support of their claim for reinstatement.

Accordingly, we reverse and remand for proceedings consistent with this opinion.

ORDER

AND NOW, this 12th day of January, 1994, the order of Court of Common Pleas of Allegheny County sustaining preliminary objections in the nature of a demurrer is hereby reversed and this case is remanded for proceedings consistent with the foregoing opinion.

Jurisdiction relinquished. 
      
      . Act of February 1, 1966, P.L. (1965) 1656, as amended, 53 P.S. § 46190 (Borough Code). Section 46190 provides in pertinent part:
      If for reasons of economy or other reasons it shall he deemed necessary by any borough to reduce the number of paid employees of the police or fire force, then such borough shall apply the following procedure: ... In the event the said police force or Are force shall again be increased the employes furloughed shall be reinstated in the order of their seniority in the service.
     
      
      . Sections 46006(3) and 46202(35) of the Borough Code, 53 P.S. §§ 46006(3), 46202(35).
     