Appeal from a judgment of the Supreme Court (Michael R. Cuevas, J.), entered April 12, 2021 in Schenectady County, which granted petitioner’s application, in a combined proceeding pursuant to CPLR article 78 and action for declaratory judgment, to, among other things, declare a portion of the Code of the City of Schenectady to be unconstitutional and awarded petitioner, among other things, counsel fees. LISA FISHER, JUSTICE Petitioner entered into a lease agreement for a second-floor apartment in the City of Schenectady from February 1, 2020 through February 1, 2021. In April of 2020, petitioner contacted respondent City of Schenectady Code Enforcement Office and reported problems with the apartment including, among other things, that only three of the windows in the apartment could be opened. Following this complaint, the owner hired a repairperson to fix the windows and, after conversation between a code enforcement officer and the owner, petitioner’s complaint was deemed resolved without a further inspection. Thereafter, the owner submitted an updated landlord registration for the subject property and, on October 19, 2020, a code enforcement officer conducted an inspection of said premises. Upon finding that several of the second-floor windows still could not be opened and there was an electrical violation, the code enforcement officer issued an order to “immediately vacate” the second floor of the premises due to “sealed emergency rescue openings” and “unsafe conditions.” The order to vacate listed multiple violations of the Property Maintenance Code of New York State (19 NYCRR part 1226 [hereinafter PMCNYS])1 and violations of the Code of the City of Schenectady. Petitioner vacated the apartment and, after the City’s corporation counsel refused to rescind the order to vacate and provide petitioner an opportunity to be heard, petitioner commenced this combined CPLR article 78 proceeding and declaratory judgment action against respondents. Therein, petitioner contended that the issuance of the order to vacate without proper notice or an opportunity to be heard violated her right to due process, was arbitrary and capricious and an abuse of discretion. Petitioner sought as relief, among other things, to vacate the order requiring her to leave the premises and for a declaration that the Code of the City of Schenectady §138-30, as it then existed, was unconstitutional for its failure to provide due process. Petitioner also sought costs, disbursements and counsel fees. Supreme Court granted this requested relief, ruling that the Code of the City of Schenectady former §138-30 regarding structurally unsafe buildings was invalid in that it failed to afford a hearing procedure for tenants ordered to vacate structures found to be unsafe, and issued a declaration to that effect. The court further vacated the order to vacate and enjoined enforcement of same until petitioner was provided a hearing. The court also awarded petitioner costs, disbursements and counsel fees pursuant to CPLR 8101, 8303-a and 8601. Respondents appeal. After the appellate briefs were filed, petitioner’s counsel notified this Court that the Code of the City of Schenectady has been amended to afford an administrative hearing for owners and occupants who are ordered to vacate, therefore rendering part of respondents’ appeal moot.2 Inasmuch as the amendment now provides for a hearing when an order to vacate is issued by a code enforcement officer based upon unsafe conditions in a residential structure (see Code of the City of Schenectady §138-30 [C.1] [3] [d]), we agree that the premise underlying petitioner’s request for a declaratory judgment challenging the constitutionality of the procedural due process denied to her under the former code provision and the basis for her CPLR article 78 proceeding are now moot (see Matter of Lasko v. Board of Educ. of the Watkins Glen Cent. Sch. Dist., 200 AD3d 1260, 1261 [3d Dept 2021]; Owner Operator Ind. Drivers Assn., Inc. v. Karas, 188 AD3d 1313, 1316 [3d Dept 2020]). Although not argued, we do not find an exception to the mootness doctrine applicable under these circumstances (see Matter of Hearst Corp. v. Clyne, 50 NY3d 707, 714 [1980]; Owner Operator Ind. Drivers Assn., Inc. v. Karas, 188 AD3d at 1316). As to the remaining issue of the award of costs, disbursements and counsel fees, respondents argue that Supreme Court erred in awarding petitioner counsel fees because this matter is not a civil action against the state within the meaning of CPLR 8601 (a) and, nonetheless, respondents were substantially justified in their acts. We disagree. “CPLR 8601 (a) mandates an award of fees and other expenses to a prevailing party in any civil action brought against the state, unless the position of the state was determined to be substantially justified or that special circumstances render an award unjust” (Matter of Vapor Tech. Assn. v. Cuomo, 203 AD3d 1516, 1517 [3d Dept 2022] [internal quotation marks and citations omitted]). The term “[s]tate” is defined as “the state or any of its agencies or any of its officials acting in his or her official capacity” (CPLR 8602 [g]). Local officials and administrators may be deemed agents of the state (see Matter of Tormos v. Hammons, 259 AD2d 434, 435-436 [1st Dept 1999]), including a municipal code enforcement officer applying the State Uniform Fire Prevention and Building Code (see Matter of Rivers v. Corron, 222 AD2d 863, 864 [3d Dept 1995]). Such a determination is made on a case-by-case basis upon examination of the applicable statutory authority and nature of the entity (see John Grace & Co. v. State Univ. Constr. Fund, 44 NY2d 84, 88 [1978]; Slutzy v. Cuomo, 114 AD2d 116, 118-119 [3d Dept 1986], appeal dismissed 68 NY2d 663 [1986]; see generally Matter of Tormos v. Hammons, 259 AD2d at 435-436). Here, the Uniform Fire Prevention and Building Code Act (Executive Law art 18) sets forth the minimum state-wide fire and building code standards (see Executive Law §§371 [2]; 379, 383), which local governments must administer and enforce (see Executive Law §381 [2]; 2020 Property Maintenance Code of NY St §103.1). Although a local government has the option to decline this responsibility by adopting a local law to that effect, thereby shifting the responsibility to the respective county (see Executive Law §381 [2];19 NYCRR §1202.1), the Code of the City of Schenectady expressly deputized respondent City of Schenectady Code Enforcement Office with the administration and enforcement of the State Uniform Fire Prevention Code (see Code of the City of Schenectady §§137-1; 137-3). Moreover, the training and certification for respondents’ code enforcement officers were also to be prescribed by the State (see Code of the City of Schenectady §137-3 [B]). Therefore, given this statutory and regulatory framework, we are satisfied that respondents’ code enforcement officer acted as a state agent in issuing the order in the course of his enforcement of the PMCNYS. Next, since it is uncontested that petitioner is a “prevailing party,” we turn to the issue of whether the City’s actions were “substantially justified” (CPLR 8601 [a]). A respondent is “substantially justified” where the position of the state is “justified to a degree that could satisfy a reasonable person, or [has] a reasonable basis both in law and fact” (Matter of New York State Clinical Lab Assn. v. Kaladjian, 85 NY2d 346, 356 [1995] [internal quotation marks and citation omitted]; see Matter of Serio v. New York State Dept. of Correctional Servs., 215 AD2d 835, 835 [3d Dept 1995]). The phrase “[p]osition of the state” is defined to mean “the act, acts or failure to act from which judicial review is sought” (CPLR 8602 [e]). Pertinently, determining if “prolonged inaction will fail the substantial justification test necessarily depends on the circumstances…[, requiring that] in each case a reviewing court must determine how long it should have taken the agency to act, considering the reasons offered by the agency for the delay” (Matter of Wittlinger v. Wing, 99 NY2d 425, 432 [2003]). “Whether the respondents’ position in a particular matter indeed was substantially justified is a determination committed to the sound discretion of the court of first instance and is reviewable as an exercise of judicial discretion” (Matter of Vapor Tech. Assn. v. Cuomo, 203 AD3d at 1517 [internal quotation marks, brackets and citations omitted]). Respondents frame their position through the initial actions of the code enforcement officer identifying fire hazards that could both cause a fire and prevent occupants from being able to safely exit the home. Respondents further reason that corporation counsel was justified in not holding a hearing because he would not “override” the code enforcement officer’s judgment and petitioner could file a CPLR article 78 proceeding, which was an adequate post-deprivation remedy (see Hughes Vil. Rest., Inc. v. Village of Castleton-on-Hudson, 46 AD3d 1044, 1046-1047 [3d Dept 2007]). Although we acknowledge that, in finding several fire violations under the City Code and PMCNYS, the code enforcement officer’s order to vacate may have been reasonable in law and fact (see Matter of New York State Clinical Lab Assn. v. Kaladjian, 85 NY2d at 356), we find that respondents’ argument is too narrow and neglects to address respondents’ other actions and inactions necessitating this litigation to remedy petitioner’s due process rights. Rather, the gravamen of the petition is the lack of an opportunity to be heard under the Code of the City of Schenectady former §138-30 (C) and the attendant delays by the code enforcement officer and corporation counsel after the order to vacate was issued. Specifically, the former Code did not afford petitioner a post-deprivation hearing after being forced to vacate her property, despite the fact that a lease creates a property interest (see Great Atl. & Pac. Tea Co. v. State of New York, 22 NY2d 75, 84 [1968]) and, as “a general rule, ‘individuals must receive notice and an opportunity to be heard before the Government deprives them of property’” (County of Nassau v. Canavan, 1 NY3d 134, 141 [2003], quoting United States v. James Daniel Good Real Prop., 510 US 43, 48 [1993]). Such due process right is recognized in the PMCNYS, which affords a tenant an opportunity to be heard prior to being removed (2020 Property Maintenance Code of NY St §103.2), except where there is an “imminent danger,” in which case a tenant must have “a post-action hearing to the extent required by applicable Constitutional provisions” (2020 Property Maintenance Code of NY St §103.2.1). Although we acknowledge the line of cases holding that a CPLR article 78 proceeding is an adequate post-deprivation remedy in certain instances (see e.g. Matter of 27 N. St., LLC v. Village of Monticello, 60 AD3d 1263, 1265 [3d Dept 2009]; Hughes Vil. Rest., Inc. v. Village of Castleton-on-Hudson, 46 AD3d at 1046-1047), “due process is a flexible constitutional concept calling for such procedural protections as a particular situation may demand” (LaRossa, Axenfeld & Mitchell v. Abrams, 62 NY2d 583, 588 [1984], citing Morrissey v. Brewer, 408 US 471, 481 [1972]; accord Morgenthau v. Citisource, Inc., 68 NY2d 211, 221 [1986]). Even accepting respondents’ premise that the code violations presented an “imminent danger,” petitioners were expressly entitled to a post-deprivation administrative hearing pursuant to Property Maintenance Code of New York State §103.2.1. That provision contemplates a prompt forum for a dispossessed occupant to address his or her concerns with the involved municipal officials. In our view, respondents’ disregard of petitioner’s repeated requests for such a hearing effectively deprived her of a meaningful opportunity to be heard. Respondents’ failure to follow up on the code violations only compounded the problem. That is, once petitioner was ordered to vacate her property, she followed the directions on the notice/placard posted by the code enforcement officer which directed occupants to contact corporation counsel’s office if they “wish to be heard.” However, when petitioner’s counsel contacted corporation counsel and requested a hearing, corporation counsel responded that the code enforcement officer’s order to vacate had merit and shifted the blame to the property owner — not addressing the request for a hearing. Petitioner’s second request for a hearing was also ignored by corporation counsel. Further, despite the fact that the order to vacate established deadlines for the property owner to remedy the defects by October 20, 2020 (windows) and November 5, 2020 (remaining defects), the code enforcement officer did not first return to reinspect the property until December 3, 2020. After failing to gain access that day, the code enforcement officer did not make a second attempt for almost two weeks, when he was again unable to enter the premises and therefore issued an appearance ticket to the property owner for a date in February 2021. During this delay, petitioner’s family (including her three-year-old grandson) had to relocate to a hotel amidst the global pandemic, where she paid a rate that was almost double her monthly rent under her lease agreement. Therefore, on this record and upon our review of the circumstances and reasons for inaction or delay proffered by respondents (see Matter of Wittlinger v. Wing, 99 NY2d at 432), we cannot say that the award of counsel fees was an abuse of discretion (see Matter of New York State Clinical Lab Assn. v. Kaladjian, 85 NY2d at 356; Matter of Serio v. New York State Dept. of Correctional Servs., 215 AD2d at 835; compare Matter of Vapor Tech. Assn. v. Cuomo, 203 AD3d at 1517). As such, Supreme Court properly awarded petitioner counsel fees under CPLR 8601. We have examined the parties’ remaining contentions and find them to be without merit. Garry, P.J., Lynch, Aarons and Ceresia, JJ., concur. ORDERED that the judgment is affirmed, with costs. Dated: September 22, 2022