OPINION BY
Judge LEAVITT.The City of York appeals a writ of mandamus issued to it by the Court of Common Pleas of York County (trial court) upon request of South End Enterprises, Inc. The writ directs the City, first, to “employ the necessary labor and materials” to stabilize the other half of a double house owned by South End and, second, to reimburse South End for its lost rental income at the rate of $445 per month until the City’s work is done. Agreeing with the City that this writ exceeds the bounds of mandamus, in that it seeks to compel the City’s exercise of discretion in a particular way, we reverse.
South End is the owner of rental property located at 314 East South Street in York, which is one half of a double home; the other half has its address at 316 East South Street. The two addresses occupy a building constructed as one and divided by an internal wall. The half at 316 East South has been vacant for several years and not been maintained. Roof tile has been lost, leaving bare plywood in places; floors have collapsed or are sagging; bricks have fallen into the basement, leaving a large hole in the front wall; and another wall is bowed.
On April 16, 2005, the City’s code enforcement officer declared the building at *356316 in danger of imminent collapse and prohibited further occupancy of both 316 and 314, even though 314 was in good repair. Accordingly, South End’s long term tenants at 314 had to relocate, and South End lost its monthly income of $445. The City then boarded up all the doors and windows on both sides and posted a notice on the outside that the entire building was unsafe.1
South End engaged the services of an engineer who confirmed the code enforcement officer’s findings, but found 314 to be otherwise sound. By July, the City had done no repairs to stabilize the 316 side of the building so that 314 could be reoccupied. Accordingly, on July 10, 2005, South End filed an action in mandamus against the City. In response, the City filed preliminary objections, but they were overruled.
At the evidentiary hearing, South End offered the testimony of Glen Heidlebaugh, who testified that he owned the property at 314 South East Street and has since October 1976.2 Heidlebaugh testified that on numerous occasions he had complained to the City about the disrepair at 316. The City responded by advising him to locate the owner and institute a civil action against him.3 Heidlebaugh established his costs that resulted from the City’s decision to declare his property unfit for habitation including, inter alia, lost rental income, attorney fees and engineering fees (both for evaluating the property and for appearing at trial). In the meantime, Hei-dlebaugh has continued to pay his property taxes.
South End also offered the testimony of its engineer, Michael Weaver, who confirmed that 316 was in danger of collapse but that 314 was sound. Weaver also explained that care needs to be taken when 316 is taken down in order to avoid damaging 314.
The City called Steven Buffington, Assistant Chief of the York City Fire Department and Building Code Official for the City. He confirmed that the vacant property at 316 had been identified as a problem since at least 1988 or 1990, prompting the City to respond with “years worth of citations [and notices of violations issued] to the various owners.” Reproduced Record at 60a. (R.R.-). Buffington explained that in April 2005, when the City determined the property at 316 was unsafe, he ordered the property to be vacated, posted, boarded-up, and demolished. The City also sent a “notice of unsafe structure” letter to the current owner of 316, Nigel Searle, who lives in Philadelphia, advising him that he was obligated to make immediate remediation. When Searle failed to respond or appeal the notice, the City initiated a civil action against Searle. In Buffington’s opinion, the City has done everything required under the ordinance by securing the property at 314 (and 316) from entry, posting a notice that the building was unsafe and, finally, pursuing Searle in a civil action.
At the conclusion of the hearing, the trial court found in favor of South End and issued a writ of mandamus directing the City to:
*357(1) employ forthwith the necessary labor and materials to stabilize the structure at 316 East South Street so that [South End’s] structure, located at 314 East South Street, is no longer deemed uninhabitable due to the danger of 316’s structural infirmities.
(2)Upon stabilizing the structure at 316 East South Street, [the City] shall provide [South End] with written notice that 314 East South Street is no longer uninhabitable due to 316’s structural insecurities.
(3)[The City] shall pay forthwith to [South End] the amount of $445.00 per month for each month [South End] was unable to rent the property at 314 East South Street.
Order of February 3, 2006. This appeal followed.
On appeal,4 the City presents six issues for our consideration, which have been consolidated for purposes of this opinion.5 Essentially, the City contends that the trial court erred in its application of the principles of mandamus. Because the appropriate response by government to the danger posed by a building about to collapse requires the exercise of discretion, that response cannot be directed by a writ of mandamus. Further, mandamus is not available where plaintiff has an alternate legal remedy, and never for the purpose of awarding damages. Additionally, the City asserts that the trial court erred in its interpretation of the ordinance.
With respect to the propriety of the writ of mandamus, the City contends that it exercised its discretion to determine the appropriate course of action to deal with the dilapidated condition of 316 East South Street, and the trial court improperly substituted its discretion for that of the code official in issuing a writ to bring about a different course than that chosen by the City.6 The trial court seemed to agree that the City had discretion with respect to deciding whether to enforce its building code but once it did so, it was required to stabilize 316 so that the law-abiding taxpayer at 314 was not dispossessed. The City believes, however, that the trial court has misconstrued the ordinance in reaching this conclusion and observes that its reasonable interpretation of its own ordinance is entitled to deference. Winslow-Quattlebaum v. Maryland Insurance Group, 561 Pa. 629, 635, 752 A.2d 878, 881 (2000).
We begin, then, with a review of the City ordinance. Section 109 of the Property Maintenance Code of the City of York (Code), entitled “Emergency Measures,” is the operative provision. Section *358109.1 addresses “imminent danger” as follows:
When, in the opinion of the code official, there is imminent danger of failure or collapse of a building or structure, which endangers life, or when any structure or part of a structure has fallen and life is endangered by the occupation of the structure, or when there is actual or potential danger to the building occupants or those in the proximity of any structure because of explosives, explosive fumes or vapors or the presence of toxic fumes, gases or materials, or operation of defective or dangerous equipment, the code official is hereby authorized and empowered to order and require the occupants to vacate the premises forthwith. The code official shall cause to be posted at each entrance to such structure a notice reading as follows: “This Structure is Unsafe and Its Occupancy Has , Been Prohibited by the Code Official.” It shall be unlawful for any person to enter such structure except for the purpose of securing the structure, making the required repairs, removing the hazardous condition or of demolishing the same.
YORK, Pa, Code § 109.1; R.R. 94a (emphasis added). Section 109.2 authorizes the code official to address the imminent danger posed by an unsafe structure as follows:
Notwithstanding other provisions of this code, whenever, in the opinion of the code official, there is imminent danger due to an unsafe condition, the code official shall order the necessary work to be done, including the boarding-up of openings, to render such structure temporarily safe whether or not the legal procedure herein described has been instituted; and shall cause such other action to be taken as the code official deems necessary to meet such emergency.
YORK, Pa, Code § 109.2; R.R. 94a (emphasis added). In implementing his authority under Section 109.2, the code official is specifically authorized to close streets and to board up buildings “when necessary for the public safety.” Yore, PA, Code, § 109.3.7 Section 109.4 of the Code, entitled “Emergency repairs,” provides as follows:
For the purposes of this section [109], the code official shall employ the necessary labor and materials to perform the required work as expeditiously as possible.
York, Pa, Code § 109.4; R.R. 94a.
Dispositive here is the meaning of the statement in Section 109 that the code official “shall order the necessary work to render [a] structure temporarily safe” by employing “the necessary labor and materials to perform the required work....” YORK, Pa, Code §§ 109.2, 109.4; R.R. 94a. “Shall” is used in statutes far more often than in speech or everyday writing, because of its cachet as a “legal” word. 1A Norman J. Singer, Sutherland Statutory CONSTRUCTION § 32A:11 (6th ed. 2002) (Sutherland). Because the word “shall” is overused, it is not examined critically before placed in a statute and, thus, can convey a diversity of meanings. These diverse meanings include those that follow:
“shall” is imperative, is directory, means “may,” expresses a mandate, either per*359missive or peremptory, applies to the past, to the future, and to the present.
Id. Unless and until legislative bodies turn to more careful draftsmanship and more sparing use of “shall,” the judiciary’s task of choosing the precise meaning of “shall” in a given context is not an easy one. Id.
Turning to Section 109 of the Code, one sees that “shall” can be replaced by “will” without affecting its meaning. This suggests that the York City Council intended simply to signify the future tense of “to be” in choosing the verb “shall.” The central purpose of Section 109.1 is to invest the code official with authority to act where there is an imminent danger. The provisions that follow the grant of authority given in Section 109.1 provide the code official with directions on how to exercise this authority. In sum, there is a good case to be made that the York City Council used the word “shall” in its directory, not mandatory, sense. Gardner v. Workers’ Compensation Appeal Board (Genesis Health Ventures), 585 Pa. 366, 376, 888 A.2d 758, 764-765 (2005) (explaining that “shall” is an ambiguous word that can be interpreted as directory as opposed to mandatory). It is, of course, the intention of the York City Council that must govern the meaning of “shall.” Commonwealth v. Baker, 547 Pa. 214, 221, 690 A.2d 164, 167 (1997).
However, even if we read City Council’s use of “shall” to convey a mandate, there are variations to a mandatory “shall.”8 Sutherland notes that “shall” may convey either a “permissive or peremptory” mandate. SutherlaND § 32A:11 (6th ed.2002). The appearance of “shall” in a sentencing statute, for example, has been construed to convey a lack of any discretion in the sentencing court. Commonwealth v. Menezes, 871 A.2d 204, 209 (Pa.Super.2005). However, it is impossible to read “shall” in the context of Section 109 as conveying a peremptory mandate intending to divest the code official of any discretion. To the contrary, City Council invested the code official with a broad grant of discretion to decide how to protect the public from a dangerous building. In the end, it is this discretion in Section 109, not its creation of a mandate, that makes the exercise of the code official’s duties beyond the reach of a mandamus action.
Mandamus is an extraordinary remedy that compels official performance of a ministerial act or a mandatory duty. Pennsylvania Dental Association v. Insurance Department, 512 Pa. 217, 227, 516 A.2d 647, 652 (1986).9 A ministerial act has been defined as
one which a public officer is required to perform upon a given state of facts in a prescribed manner in obedience to the mandate of legal authority and without regard to his own judgment or opinion concerning the propriety or impropriety of the act to be performed.
Council of City of Philadelphia v. Street, 856 A.2d 893, 896 (Pa.Cmwlth.2004) (cita*360tions omitted). See, e.g., Murphy v. Township of Abington, 88 Pa.Cmwlth. 491, 490 A.2d 483, 488 (1985) (township’s issuance of a certification that a firefighter had died was a ministerial act); Rose Tree Media School District v. Department of Public Instruction, 431 Pa. 233, 234, 244 A.2d 754, 755 (1968) (school district’s payment of expenses by application of a statutory formula is a ministerial act). Where the governmental action sought involves the exercise of discretion, the court may direct the agency to do the act but may never direct the exercise of discretion in a particular way. Matesic v. Maleski, 155 Pa.Cmwlth. 154, 624 A.2d 776, 778 (1993). Moreover, mandamus will not lie to compel a revision of the decision resulting from such exercise of discretion, though in fact, the decision may be wrong. Anderson v. City of Philadelphia, 348 Pa. 583, 587, 36 A.2d 442, 444 (1944).
Section 109.2 of the Code provides that where the code official, in his opinion, believes a building to present an imminent danger, he “shall order the necessary work to render such structure temporarily safe and shall cause such action to be taken as the code official deems necessary to meet such emergency.” York, Pa, Code § 109.2; R.R. 94a (emphasis added). The ordinance does not say how the code official is to make the structure temporarily safe to meet the emergency.10 Rather, it is the nature of the emergency itself that will determine how to make a structure temporarily safe or to meet the emergency. The emergency could be the result of a building fire, the ongoing neglect of the building owner or a gas leak. As a consequence, the City must exercise judgment and discretion to develop the appropriate response. That response may require no more than posting notices and boarding up windows and doors on a building; on the other hand, it may require more significant action such as closing a street or even vacating an entire City block, as in the event of a gas leak. Section 109.3.11 The variety of potential emergency circumstances requires the code official to exercise discretion; in doing so, the code official performs more than a mere ministerial act.
Here, upon finding the building at 316 East South Street in danger of imminent collapse, the code official perceived a danger to anyone who could gain access to 316 or to South End’s property at 814. The code official determined, in his opinion, that the entire building had to be vacated, posted, and boarded up to make it temporarily safe. This course of action met the emergency, in his view. The trial court deemed these actions inadequate because they did not render to make a structure habitable, only to make it “temporarily safe as the code official deems necessary to meet such emergency.” York, Pa, Code § 109.2; R.R. 94a. Here, the code official exercised his discretion to meet the emergency by eliminating access to the dangerous building. Once the City exercised its discretion to act in this particular way, the trial court could not revisit that decision sitting in mandamus, even if the code offi*361cial was wrong in his judgment. Anderson, 348 Pa. at 587, 36 A.2d at 444.12
From at least 1990 to 2005 the City of York watched 316 East South Street decline to the point of danger to the public. It issued citations to the property owner, but it did nothing to enforce these citations or to force the property owner to repair 316. As a result, South End, which maintained their property in accordance with the Property Maintenance Ordinance and paid its taxes, has been ejected from its property. We share the trial court’s frustration. That we find the City beyond the reach of a writ of mandamus does not mean that we condone its failure to succeed at a core municipal function, i.e., the enforcement of its own building code.13
For these reasons, we reverse.
ORDER
AND NOW, this 19th day of December, 2006 the order of the Court of Common Pleas of York County dated February 3, 2006, in the above captioned matter is hereby reversed.
. Subsequently, the City then located the owner of 316 East South Street and commenced an action; the owner is now under a court order to correct the problem at 316.
. The connection between Heidlebaugh and the corporation "South End Enterprises, Inc.” was never established.
.Heidlebaugh testified that he believed 316 was owned by the Tax Claim Bureau. He also stated that he did not pursue the owner of 316 because he did not know who the owner was. Heidlebaugh acknowledged that he never went to the Recorder of Deeds Office to identify the owner.
. Our scope of review in a mandamus action is to determine whether the trial court abused its discretion or committed an error of law and whether sufficient evidence exists to support its findings. Philomeno & Salamone v. Board of Supervisors of Upper Merion Township, 882 A.2d 1044, 1047 (Pa.Cmwlth.2005).
. The City’s "issues” are really just separate arguments to support its central issue that the trial court committed legal error in issuing a writ of mandamus.
. The trial court stated that once the City
determines that a structure is dangerous, [it] must take certain action to make it temporarily safe. Sometimes, this will consist only of posting notices and boarding-up doors. The instant case, however, is not one of those scenarios. Neighboring property is in danger, and [South End] is left with no other remedy than to ask [the City] to do what it is obligated to do, namely, stabilize the property so that no one — vagrants, passersby, and neighboring structures — is injured or damaged.
Trial Court Opinion of February 3, 2006, at 5.
. Section 109.3 states:
When necessary for the public safety, the code official shall temporarily close structures and close, or order the authority having jurisdiction to close, sidewalks, streets, public ways and places adjacent to unsafe structures, and prohibit the same from being utilized.
York, Pa, Code § 109.3; R.R. 94a
. In most cases, however, the word "shall” conveys a mandate not a suggestion. See, e.g., Cranberry Park Associates ex rel. Viola v. Cranberry Township Zoning Hearing Board, 561 Pa. 456, 460, 751 A.2d 165, 167 (2000) ("Here, the word 'shall' denotes a mandatory, not permissive instruction.”).
. The basic test for issuance of a writ of mandamus is well established. It may issue only where there is a clear legal right in the plaintiff to compel the performance of a ministerial act or mandatory duty, a corresponding duty in the defendant, and lack of any other appropriate and adequate remedy at law. Delaware River Port Authority v. Thornburgh, 508 Pa. 11, 20, 493 A.2d 1351, 1355 (1985). Because the right must be clear, one might argue that a mandamus action is not the appropriate proceeding for interpreting an ambiguous statute.
. The dissent asserts that the duty to act is non-discretionaiy. However, this conclusion cannot be squared with the language of the ordinance that requires the code official to do acts "necessary” to meet the emergency. The code official decides what is necessary. In this case, he decided that closing entry to the building was sufficient to render the structure temporarily safe. An action in mandamus is not the vehicle for reviewing whether the code official exercised his judgment correctly. Anderson, 348 Pa. at 587, 36 A.2d at 444.
. See note 7, supra, for text of Section 109.3.
. Because we conclude the trial court erred in substituting its discretion for that of the City’s code official, we need not address the City’s remaining issues.
. By contrast, the vigorous Township of Upper Merion enforced its building code by initiating a suit in equity against a developer where retaining walls were in danger of collapse, causing a risk of danger to nearby homeowners. The Woods at Wayne Homeowners Association v. Gambone Brothers Construction Company, Inc., 893 A.2d 196 (Pa.Cmwlth.2006). The City could have followed this example, or performed the repairs necessary to make 316 structurally safe and then recovered its costs from the owner of 316. Section 109.5 of the Code states that the City “shall institute appropriate action against the owner of the ... unsafe structure ... for the recovery of such costs.” York, Pa, Code § 109.5; R.R. 94a.