
914 A.2d 1234 (2006)
Walter W. FISCHER, Trustee of Walter W. Fischer 1993 Trust
v.
NEW HAMPSHIRE STATE BUILDING CODE REVIEW BOARD.
No. 2006-155.
Supreme Court of New Hampshire.
Argued: September 12, 2006.
Opinion Issued: December 20, 2006.
*1235 Gottesman & Hollis, P.A., of Nashua (Anna Barbara Hantz on the brief and orally), for the petitioner.
Kelly A. Ayotte, attorney general (Mary E. Maloney, assistant attorney general, on the brief and orally), for the State.
HICKS, J.
The petitioner, Walter W. Fischer, Trustee of Walter W. Fischer 1993 Trust, appeals an order of the Superior Court (Fauver, J.) affirming a determination by the New Hampshire State Building Code Review Board (board) that the buildings on nine Durham properties owned by the petitioner *1236 do not qualify as two-family dwellings under the State Fire Code (code). We affirm.
The trial court found the following facts. The buildings at issue were constructed as two-family dwellings in 1968. Each unit has three bedrooms, two and one half baths, a kitchen, living room and dining room. The petitioner leases these units to groups of four to six University of New Hampshire students.
Local fire officials have periodically inspected the buildings and, through at least May 2002, have classified them as two-family dwellings. In 2002, a fire occurred in one of the buildings which, according to the respondent board, caused the Durham Fire Department to review the building's classification and fire safety standing. The Durham Fire Marshal notified the petitioner on July 1, 2003, that his buildings were improperly classified under the code. The Durham Fire Marshal then reclassified the buildings as "lodging or rooming houses" and required modifications to the buildings to bring them into compliance with the code.
The petitioner appealed the reclassification to the state fire marshal, who affirmed. That decision was appealed to, and affirmed by, the board. The petitioner then appealed to the superior court, claiming that "the Board improperly determined that subsequently-enacted fire regulations apply to the petitioner's use of the buildings, even though the petitioner's use has not changed for over 30 years." The trial court affirmed, except as to a waiver request, which was remanded for evaluation by the fire marshal.
On appeal, the petitioner argues that: (1) reclassification of his buildings "improperly interferes with [his] vested right to use the structures as duplexes"; (2) the code exempts existing uses from new requirements unless there is a change in use; (3) the code "arbitrarily discriminates between related and unrelated individuals"; and (4) the petitioner was denied due process with respect to the regulatory change imposed upon his property.
On appeal of the board's decision to the superior court, "[t]he burden of proof [is] on the appellant to show that the decision of the board was clearly unreasonable or unlawful." RSA 155-A: 12, II (Supp. 2006). We, in turn, will not disturb the decision of the trial court unless it is unsupported by the evidence or legally erroneous. Cf. Conservation Law Found. v. N.H. Wetlands Council, 150 N.H. 1, 4, 834 A.2d 193 (2003).
The plaintiff first argues that his property is "grandfathered" from reclassification to a new occupancy category under the code. He grounds his argument in two provisions of the New Hampshire Constitution: Part I, Article 23, prohibiting retrospective laws, and Part I, Article 12, prohibiting takings of property without just compensation. Specifically, he contends that the reclassification of his property "imposes an incompatible later enacted code requirement on a pre-existing use" and "results in an unconstitutional retrospective application and improperly denies [him] his vested right to continue to use the property as originally classified."
We first address whether the reclassification at issue is a "retrospective application" of a "later enacted code requirement." The State asserts that "[t]he Fire Marshal prospectively applied the correct classification under the State Fire Code to the [plaintiff's] property" and did not impose a penalty "for noncompliance with the Code before that date." As such, the application of the code in this case is not retrospective. As the Supreme Court of Colorado has noted:

*1237 The constitutional ban of retrospective operation does not prevent a city from enacting and enforcing ordinances to protect the health and safety of the community.
The purpose of the constitutional ban of retrospective legislation, like the ban on ex post facto laws, is to prevent the unfairness that results from changing the legal consequences of an act after the act has occurred. In this case, [the plaintiff] was not penalized for violation of the Safety Code for remodeling that was completed prior to enactment of the Safety Code. Application of a safety code to buildings that were constructed in a different period under different code requirements does not constitute unconstitutional retrospective legislation.
Van Sickle v. Boyes, 797 P.2d 1267, 1271 (Colo.1990) (citations omitted).
The plaintiff next argues, relying upon Part I, Article 12, that the reclassification of his property deprives him of a vested right to a nonconforming use. He cites Dugas v. Town of Conway, 125 N.H. 175, 182, 480 A.2d 71 (1984) (quotation, brackets and ellipses omitted), for the proposition that "a past use creates vested rights to a similar future use, so that a town may not unreasonably require the discontinuance of a nonconforming use." Although Dugas was a dispute over attorney's fees and costs, it arose out of a takings claim, and the above-quoted language appeared in that context. Id. at 181-82, 480 A.2d 71. Dugas also recognized, however, that "[r]easonable regulations, aimed at promoting the health, safety and general welfare of the community, may not require compensation." Id. at 182, 480 A.2d 71; see also Loundsbury v. City of Keene, 122 N.H. 1006, 1009, 453 A.2d 1278 (1982) ("Certainly, a town may proscribe harmful property-related activity without providing compensation."). As the Washington Supreme Court aptly stated:
There is no such thing as an inherent or vested right to imperil the health or impair the safety of the community. . . . It would be a sad commentary on the law, if municipalities were powerless to compel the adoption of the best methods for protecting life in such cases simply because the confessedly faulty method in use was the method provided by law at the time of its construction.
City of Seattle v. Hinckley, 40 Wash. 468, 82 P. 747, 748-49 (1905). We concur with this analysis. Accordingly, we conclude that the plaintiff does not have a vested right to a continued classification as a two-family dwelling for purposes of fire code application.
Our decision in Durham v. White Enterprises, Inc., 115 N.H. 645, 348 A.2d 706 (1975), does not alter our conclusion. White Enterprises involved the same duplex properties at issue here. The petitioner and others challenged a 1971 amendment to the Town's zoning ordinance that limited lawful density of occupancy to no more than four unrelated persons. Id. at 647-48, 348 A.2d 706. We observed that the leasing of these units to groups of up to six unrelated individuals was a lawful use under the pre-1971 ordinance and held that the "Fischers have acquired the right to continue this nonconforming use under the ordinance as amended in 1971." Id. at 651, 348 A.2d 706.
Our decision in White Enterprises was not based upon constitutional limitations and vested rights, but upon the terms of the amended zoning ordinance itself, which contained a grandfather clause exempting, under certain conditions, "existing lawful use[s]" from the requirements of the amended ordinance. Id. at 650, 348 A.2d *1238 706. Thus, White Enterprises has no application to the instant case.
The plaintiff next argues that the code has its own grandfather provision, section 1-9.2, that prohibits the reclassification of his property. That section provides:
Existing buildings that are occupied at the time of adoption of this Code shall remain in use provided that the following conditions are met:
(1) The occupancy classification remains the same.
(2) There exists no condition deemed hazardous to life or property that would constitute an imminent danger.
The petitioner argues that this provision "specifically exempts occupied preexisting buildings from code compliance so long as the use is not changed and there is no imminent danger to life or property." The State counters that this is not a grandfather provision at all, but merely serves to "permit the continued occupancy or use, of the building under certain specific criteria during the time it takes to bring the building[] in[to] compliance with the [code]."
The provisions of the code at issue were adopted by agency rule. See e.g., N.H. Admin. Rules, Saf-C 6008.01 (2003) (adopting, with modification, the 2000 edition of the NFPA Fire Prevention Code); N.H. Admin. Rules, Saf-C 6008.03 (2003) (adopting the 2000 edition of the NFPA 101 Life Safety Code). When construing agency rules, we ascribe to the words used their plain and ordinary meanings, where possible. Appeal of Flynn, 145 N.H. 422, 423, 764 A.2d 881 (2000). In addition, we do not look at the rule in segments, but rather as a whole. Appeal of Alley, 137 N.H. 40, 42, 623 A.2d 223 (1993). While we accord some deference to an agency's interpretation of its regulations, "[w]e still must examine the agency's interpretation to determine if it is consistent with the language of the regulation and with the purpose which the regulation is intended to serve." Id. (quotation omitted). Furthermore, "[a]dministrative officials do not possess the power to contravene a statute and we will not construe an administrative rule as an attempt to do so." Woodman v. Perrin, 124 N.H. 545, 549, 474 A.2d 999 (1984) (citation omitted).
The state fire marshal's apparent interpretation of the code is that it "has no provisions for `grandfathering' any property. [Rather,] [t]he code has specific requirements for `existing' and `new' construction." The petitioner acknowledges that, in some instances, the code imposes different requirements on new and existing buildings and that "[r]equirements for `existing buildings' will apply if more restrictive than those imposed at the time of [construction plan] approval." See NFPA 101 Life Safety Code A.1.4, A.3.3.25.3. He does not appear to contend, however, that he is being required to comply with code provisions for new, as opposed to existing, lodging or rooming houses; rather, his apparent argument is that section 1-9.2 prohibits a reclassification of his property that would require him to comply with any code provisions for lodging or rooming houses.
The interpretation of code section 1-9.2 advanced by the State, and employed by the fire marshal, is "consistent with the language of the regulation and with the purpose which the regulation is intended to serve." Appeal of Alley, 137 N.H. at 42, 623 A.2d 223. The enabling legislation for the code states that "[t]he rules [adopted thereunder] shall apply to existing buildings, structures or equipment" and provides that "[a] reasonable time, as determined by the state fire marshal, shall be allowed to make necessary alterations." RSA 153:5 (2002). The code, in turn, *1239 states that it "shall apply to both new and existing conditions." NFPA 1 Fire Prevention Code, 1-5.1 (2000). Section 1-5.5 provides:
Buildings in existence or permitted for construction prior to the adoption of this Code shall comply with the provisions stated herein or referenced for existing buildings.
. . .
Exception: A limited but reasonable time shall be allowed for compliance with any part of this Code for existing buildings, commensurate with the magnitude of expenditure, disruption of services, and degree of hazard. Occupied existing buildings shall comply with 1-9.2
Finally, the NFPA Fire Prevention Code Handbook (2000) explains:
In the case of existing occupancies, the Code, in many instances, provides specific exemptions from the requirements for new occupancies. In other instances, however, there may be no difference in the requirements between new and existing occupancies. It is the Code's intent that existing buildings be brought into compliance with the provisions in this edition for existing buildings.
We conclude that section 1-9.2 does not exempt preexisting, occupied buildings from compliance with code provisions applicable to existing buildings. Rather, as argued by the State, it permits, under certain conditions, "the continued occupancy or use, of the building . . . during the time it takes to bring the building[] in[to] compliance with the [code]."
The petitioner next argues that the code impermissibly discriminates between related and unrelated individuals. The code defines one- and two-family dwellings to "include buildings containing not more than two dwelling units in which each dwelling unit is occupied by members of a single family with not more than three outsiders, if any, accommodated in rented rooms." NFPA 1 Fire Prevention Code, 2-1.112. The petitioner argues that "[r]estricting unrelated individuals from sharing a duplex or single family home is . . . an arbitrary classification" in violation of the Fourteenth Amendment to the United States Constitution.
The restriction does not involve a fundamental right. See Village of Belle Terre v. Boraas, 416 U.S. 1, 7, 94 S.Ct. 1536, 39 L.Ed.2d 797 (1974); see also White Enterprises, 115 N.H. at 648, 348 A.2d 706. Instead it is an "economic and social" regulation that will withstand an equal protection challenge if the classification is "reasonable, not arbitrary . . . and bears a rational relationship to a permissible state objective." Village of Belle Terre, 416 U.S. at 8, 94 S.Ct. 1536 (quotations and brackets omitted).
As previously noted, the purpose of the code is the "protection from fire and fire hazards for people in the state and for the general welfare of property and people within the state." RSA 153:5. We readily conclude that these are permissible state objectives. The State argues that the "family" classification is not arbitrary, but is "rationally related to how individuals will respond in case of fire." In testimony before the board, the Durham Fire Marshal explained the rationale behind the classification:
Well, because the people are not related, they have no vested interest in one another, other than they're . . . they may be friends, the Code has made some additional requirements to make sure each individual is safe as opposed to a single family where they are probably going to be looking out for one another, *1240 making . . . being aware . . . [of their] comings and goings and whatnot.
We cannot say that the classification is not rationally related to a permissible state objective.
Finally, the plaintiff argues that the procedures used by the fire marshal and the board did not afford him due process. He appears to contend that he should have been afforded a hearing under New Hampshire Administrative Rule, Saf-C 6006.02(f)(1), which entitled any person aggrieved by a determination of the state fire marshal to an adjudicative hearing before the state fire marshal. N.H. Admin. Rules, Saf-C 6006.02 (repealed September 23, 2004).
As the trial court correctly ruled, however, Rule Saf-C 6006.02 was preempted in 2002 by the adoption of RSA 155-A:11, which provides that appeals from the state fire marshal's decisions shall be heard by the board. See RSA 155-A:11, I (Supp.2006). Since an administrative rule cannot contravene a statute, Woodman, 124 N.H. at 549, 474 A.2d 999, the rule must yield. Thus, the plaintiff was not entitled to a hearing by the fire marshal.
The plaintiff acknowledges that a hearing was held before the board, but argues that while the board heard "testimony concerning the interpretation of the code, . . . [it] did not review the reasonableness of the specific fire safety measures imposed." He also notes that no "public hearing" was held. Thus, the plaintiff appears to contend that he was entitled to the same procedures used in the rulemaking process. See RSA 541-A:11 (Supp.2006). As the State points out, the state fire marshal did not adopt a new rule, but merely enforced the existing rule. Thus, no public hearing on the rule's reasonableness was required.
Affirmed.
BRODERICK, C.J., and DALIANIS, DUGGAN and GALWAY, JJ., concurred.
