#### DAVID M. LYNN and wife, LORNA L. LYNN v. OVERLOOK DEVELOPMENT, a joint venture; ROGER L. JONES and wife, MYRA E. JONES; MARSHALL N. KANNER; CITY OF ASHEVILLE, a municipal corporartion; J. R. SMITH; MARK RUMFELT; WIND-IN-THE-OAKS HOMEOWNERS ASSOCIATION, INC., a North Carolina corporation; JOE C. SWICEGOOD, SR. and wife, DOROTHY C. SWICEGOOD; GARLAND L. NORTON; JOE P. EBLEN and wife, ROBERTA S. EBLEN; BEN KANNER and wife, SYLVIA KANNER; GARY PHILLIPS and wife, DEBBY PHILLIPS; DEAN J. SCHRANZ and wife, MARGIE SCHRANZ; REBECCA M. PRESSLEY; MICHAEL D. BRANDSON and STEVIE A. SALIDO; JOSEPH CARR SWICEGOOD, JR.; J. DEAN DEWEESE, JR.; B. PAUL GOODMAN; KEITH J. DUNN; DEBRA M. LEATHERWOOD; BENJAMIN BIBER and wife, ENGLISH W. BIBER; ROBERTA HORVATH; ROBERT C. NEWTON, JR.; ROBERT M. SMITH and wife, SANDY SMITH; PAUL E. GILSDORF and wife, LAURA L. GILSDORF; PAUL A. ROBICHAUD; TERRENCE W. BURT; SOUTHEASTERN SAVINGS AND LOAN COMPANY, a North Carolina corporation; DAVID E. MATNEY, III, Trustee; KENNETH M. MICHALOVE, WILHELMINA B. BRATTON, MARY LLOYD FRANK, RUSSELL M. MARTIN, NORMA T. PRICE and ROBERT YORK, members of the Asheville City Council in their official capacities; and W. LOUIS BISSETTE, JR., Mayor of the City of Asheville in his official capacity

No. 204PA90

(Filed 2 May 1991)

Municipal Corporations § 10 (NCI3d) — purchase of uninhabitable townhouse unit — acts and omissions of city building inspector— occupancy as intervening cause of damages

Plaintiffs’ damages from their purchase of a new townhouse unit that was unfit for habitation were not proximately caused by a city building inspector’s alleged violations of N.C.G.S. §§ 160A-417, -420, and -423 and State Building Code sections 105.4(f), 105.6, and 105.10 by his issuance of a building permit to an unlicensed contractor, his failure to observe Building Code violations in construction of the unit, and his failure to issue a certificate of compliance or notify plaintiffs of Building Code violations because plaintiffs’ election to take title and assume occupancy of the townhouse in violation of the law *690before the building inspector had an opportunity to make the final inspection and issue a certificate of compliance constituted an intervening, independent cause of plaintiffs’ damages. Therefore, the trial court did not err in allowing defendants’ Rule 12(b)(6) motion to dismiss plaintiffs’ claim against defendant city based on defendant building inspector’s willful and wanton conduct.

Am Jur 2d, Municipal, County, School, and State Tort Liability § 221.

On discretionary review pursuant to N.C.G.S. § 7A-31 of a decision of the Court of Appeals, 98 N.C. App. 75, 389 S.E.2d 609 (1990), affirming in part and reversing in part an order entered by Lamm, J., on 10 May 1989, after hearing at the 1 May 1989 Civil Session of Superior Court, BUNCOMBE County. Heard in the Supreme Court 11 December 1990.

Charles R. Brewer for plaintiff-appellants.

Womble Carlyle Sandridge & Rice, by Tyrus V. Dahl, Jr., Ellen M. Gregg, and Lawrence Egerton, for defendant-appellees the City of Asheville and J.R. Smith.

North Carolina Academy of Trial Lawyers, by Michael K. Curtis, amicus curiae.

North Carolina Association of County Commissioners, by James Blackburn,- General Counsel, and North Carolina League of Municipalities, by Ellis Hankins, amici curiae.

MEYER, Justice.

After this Court’s review of the record, our appraisal of the facts found in the complaint and exhibits differs somewhat from the facts stated in the opinion of the Court of Appeals. This action arises out of a contract for the purchase and sale of a new townhouse unit which plaintiffs entered into with Overlook Development (not a party to this appeal) on 22 February 1985. Plaintiffs allege that the relevant building permits were issued by J.R. Smith, a City of Asheville building inspector, to Overlook Development in December 1984 but that plaintiffs did not obtain title to the unit until 23 August 1985. Plaintiffs further allege that on 23 August 1985, an employee of the Building Inspections Department of the City of Asheville telephoned a representative of Carolina Power *691& Light Company, informed the company that a final inspection of plaintiffs’ unit had been done, and authorized the power company to hook up the electricity to the building.

Plaintiffs immediately assumed occupancy upon completion of the unit’s construction in August 1985. No certificate of compliance, as required by N.C.G.S. § 160A-423 and section 105.10 of the North Carolina State Building Code (“Building Code”) as a precondition for legal occupancy, was ever issued as to plaintiffs’ unit. However, an inspection was conducted by J.R. Smith during August 1985 after the plaintiffs moved in, but Smith did not issue a certificate of compliance, inform plaintiffs of any problems with the construction, or inform them that they were occupying the unit in violation of N.C.G.S. § 160A-423.

After plaintiffs moved into their „new home in August, they discovered numerous defects in the construction and workmanship of their unit in violation of the Building Code, as well as problems with grading, drainage, and driveway pavement failure. These defects were the subject of a later condemnation proceeding brought by the City of Asheville (“City”) against plaintiffs on 5 December 1988 and 18 January 1989, resulting in a determination that plaintiffs’ unit was unfit for human habitation and an order to demolish the unit at the plaintiffs’ expense.

On 6 March 1989, plaintiffs filed their verified complaint, alleging eleven causes of action, seeking relief against numerous defendants (forty-six) on a variety of theories of recovery. Relevant to this appeal, plaintiffs allege that the City, through its agents, had a duty to inspect the unit and that defendants’ failure to inspect and/or order correction of the alleged Building Code violations was a proximate cause of plaintiffs’ damages. Plaintiffs sought compensatory and punitive damages against defendants City of Asheville and City Building Inspector J.R. Smith, in both his official and individual capacities, for his alleged acts and omissions pertaining to the inspection of the townhouse unit.

Prior to answering, these defendants filed a motion to dismiss plaintiffs’ claim pursuant to N.C.R. Civ. P. 12(b)(6) for failure to state a claim upon which relief can be granted. Following a hearing on these motions, the trial court entered its order on 10 May 1990, allowing defendants’ motions as to all claims against these defendants, except those against J.R. Smith in his individual capacity for compensatory and punitive damages arising out of his al*692leged willful, wanton, unlawful, culpable, and/or reckless conduct outside the scope of his duties as a city employee.

The Court of Appeals reversed the trial court’s dismissal of plaintiffs’ claim for compensatory damages against the City “predicated on allegations of inspector Smith’s willful and wanton conduct” and affirmed the order in all other respects. Lynn v. Overlook Development, 98 N.C. App. 75, 80, 389 S.E.2d 609, 613 (1990). On 26 July 1990, this Court granted plaintiffs’ petition for discretionary review.

A motion to dismiss under Rule 12(b)(6) of the North Carolina Rules of Civil Procedure presents the question whether, as a matter of law, the allegations of the complaint, treated as true, are sufficient to state a claim upon which relief can be granted under some legal theory. Jackson v. Bumgardner, 318 N.C. 172, 347 S.E.2d 743 (1986). The complaint must be construed liberally, and the court should not dismiss the complaint unless it appears that the plaintiffs could not prove any set of facts in support of their claim which would entitle them to relief. Peoples Security Life Ins. Co. v. Hooks, 322 N.C. 216, 367 S.E.2d 647, reh’g denied, 322 N.C. 486, 370 S.E.2d 227 (1988).

In this connection, we have examined the applicable statutes, the Building Code, and the trial court record. Plaintiffs allege that City Building Inspector Smith was negligent under the standards set forth at N.C.G.S. §§ 160A-411 to -425 and Building Code sec. 105 in that he improperly issued a building permit to Overlook Development (which did not hold a valid general contractor’s license); failed to observe code violations in the construction of the unit; or alternatively, having observed such violations, failed to take appropriate remedial measures, including notifying plaintiffs and revoking the building permit. Plaintiffs contend that these allegations are sufficient to withstand the defendants’ motion to dismiss pursuant to Rule 12(b)(6). Since plaintiffs have premised their right to recover upon the violation of N.C.G.S. §§ 160A-417, -420, and -423 and Building Code secs. 105.4(f), 105.6, and 105.10, we must first determine whether the statute complained of is a safety statute and whether plaintiffs belong to the class of persons for whose protection and benefit the statute and the Building Code were enacted.

N.C.G.S. § 160A-411 requires that cities in North Carolina, by one of several authorized methods, perform the duties and respon*693sibilities listed in N.C.G.S. § 160A-412, including enforcing state and local laws relating to the construction of buildings, installation of facilities, and maintenance of buildings. N.C.G.S. § 160A-411 (1982). These duties and responsibilities include issuing or denying permits, making any necessary inspections, and issuing or denying certificates of compliance. N.C.G.S. § 160A-412 (1982). No permits are to be issued unless the work is to be performed by a duly licensed contractor when any provision of a statute or ordinance so requires. N.C.G.S. § 160A-417 (1982). As the work pursuant to a permit progresses, city building inspectors make as many inspections of the work as may be necessary to satisfy them that it is being done according to all applicable laws and all terms of the permit. N.C.G.S. § 160A-420 (1982). The permit holder is required to give the inspector timely notice when the work is ready for the required inspections. North Carolina State Building Code sec. 105.6(b) (1978). The final step in this statutory scheme is N.C.G.S. § 160A-423, which provides, inter alia, that no completed building shall be occupied until a certificate of compliance is issued pursuant to a final inspection stating that the structure complies with all applicable state and local laws. When the building inspector finds any defects or finds that the building has not been constructed in accordance with applicable state and local laws, he is to notify the owner or occupant. N.C.G.S. § 160A-425 (1982).

The pertinent sections of the Building Code provide as follows:

> 105.4 — Application for Permit

> (f) Where the General Statutes require a licensed contractor for certain types of construction, no permit shall be issued for such construction except in compliance with these statutes.

> 105.6 — Inspections Required.

> (a) As the work covered by permit progresses, local inspectors shall make as many inspections thereof as necessary to satisfy them that the work is being done in accordance with this Code, any other applicable State and local laws, and the terms of the permit.

> (b) When required, the Inspection Department shall make at least the following inspections of all work being performed *694under the permit and shall either approve that portion of the construction as completed or shall notify the permit holder or his agent wherein the same fails to comply with the law. The permit holder or his agent shall give timely notice to the Inspection Department when the work for these inspections are [sic] ready:

> Final Inspection: To be made after the building or structure is completed and ready for occupancy.

> (c) Work shall not proceed on any part of a building or structure beyond the point indicated for each inspection described in subsection (b) above until written approval has been received from the [Inspection [Department.

> 105.10 — Certificates of Compliance

> (a) At the conclusion of all work done under a permit, the appropriate inspector or inspectors shall make a final inspection, and if they find the completed work complies with this Code and all other applicable State and local laws and with the terms of the permits, the Inspection Department shall issue a certificate of compliance.

> (b) No new building or structure or part thereof may be occupied . . . until the Inspection Department has issued a certificate of compliance.

> (d) Occupying a building or structure in violation of this section shall constitute a misdemeanor.

North Carolina State Building Code (1978).

The statutes and the sections of the Building Code in question are silent as to the legislative purpose and as to the class of persons for whose benefit they were enacted. In such a case, the application of the subject statutes and sections of the Building Code to the plaintiffs, invoking their protection, must be determined from a careful consideration of the provisions of the statutes and the Building Code and of the ends they were manifestly intended to accomplish. In the interpretation and construction of statutes, it is a primary *695rule that the intention of the legislature should be ascertained and given effect. McLean v. McLean, 323 N.C. 543, 374 S.E.2d 376 (1988). The enabling statute which calls for the institution of a State Building Code Council and the North Carolina Residential Building Code specifically addresses protection of the interests of the public, and provides, in part:

> All regulations contained in the North Carolina State Building Code shall have a reasonable and substantial connection with the public health, safety, morals, or general welfare, and their provisions shall be construed liberally to those ends.

N.C.G.S. § 143438(c) (1986) (emphasis added). It appears that one of the specific purposes of N.C.G.S. §§ 160A-411 to -425 is to promote the safety of the general public. See also State v. Walker, 265 N.C. 482, 484, 144 S.E.2d 419, 421 (1965) (“It is within the police power of the General Assembly and of a city, when authorized, to establish minimum standards, materials, designs, and construction of buildings for the safety of the occupants, their neighbors, and the public at large”); Jackson v. Housing Authority of High Point, 73 N.C. App. 363, 326 S.E.2d 295 (1985) (the purpose of N.C.G.S. § 160A-425 is to protect the lives and limbs of occupants of the buildings), aff’d, 316 N.C. 259, 341 S.E.2d 523 (1986). The language of the Building Code suggests that the particular provisions of the Code pertinent here are safety regulations. The intent of the Building Code is evident in its stated purpose to promote the “public health, safety, morals, or general welfare.” North Carolina State Building Code sec. 101.2 (1978).

It is unclear, however, whether these particular plaintiffs as purchasers are within the class intended to be protected by the statutes and whether the harm resulting from Smith’s alleged acts or omissions is the specific type of harm which the statutes were intended to prevent. Assuming, without deciding the issue, that a city building inspector owes a statutory duty to these particular plaintiffs as purchasers, the plaintiffs’ complaint fails to state a claim upon which relief can be granted against the City. The trial court did not err in dismissing plaintiffs’ complaint in that, as a matter of law, the acts or omissions of City Building Inspector Smith did not cause the damages of which these plaintiffs complain, that is, their purchase of a house that was unfit for habitation.

The plaintiffs contend that defendants were negligent per se because they violated the provisions of N.C.G.S. §§ 160A-417, -420, *696and -423 and Building Code sec. 105 relating to permits, inspections, and the certificate of compliance. Although the violation of a statute which imposes a duty upon the city building inspector in order to promote the safety of the public, including the plaintiffs, may be negligence per se, such negligence is actionable only if it is the proximate cause of injury to the plaintiff. Ratliff v. Power Co., 268 N.C. 605, 151 S.E.2d 641 (1966); see also Bell v. Page, 271 N.C. 396, 156 S.E.2d 711 (1967). Proximate cause has been defined as “a cause which in natural and continuous sequence, unbroken by any new and independent cause, produced the plaintiff’s injuries, and without which the injuries would not have occurred, and one from which a person of ordinary prudence could have reasonably foreseen that such a result, or consequences of a generally injurious nature, was probable under all the facts as they existed.” Adams v. Mills, 312 N.C. 181, 192, 322 S.E.2d 164, 171 (1984) (emphasis added); accord Hairston v. Alexander Tank & Equipment Co., 310 N.C. 227, 311 S.E.2d 559 (1984); Adams v. Board of Education, 248 N.C. 506, 103 S.E.2d 854 (1958).

Plaintiffs allege violations of N.C.G.S. § 160A-417 and Building Code sec. 105.4(f) in that the city building inspector improperly issued a building permit to Overlook Development, which did not hold a valid general contractor’s license. However, even assuming the action of issuing the permit by she city building inspector in December 1984 was negligent, the transaction was between the city building inspector and Overlook Development. The contract for the purchase and sale was not entered into between Overlook Development and the plaintiffs until 22 February 1985, and plaintiffs allege that the title to the townhouse unit did not pass to them until 23 August 1985.

As to the plaintiffs’ allegation that the city building inspector failed to observe violations of the Building Code pursuant to N.C.G.S. § 160A-420 and Building Code sec. 105.6, the statute only requires that the building inspector make inspections of work in progress when “necessary.” The statute and the Building Code contemplate that the permit holder or his agent will notify the inspection department that the work for the necessary inspections is ready. Plaintiffs have not alleged that the city building inspector was notified or that he failed to make any “necessary” inspections. Finally, plaintiffs allege that defendants failed to issue a certificate of compliance or failed to notify them of Building Code violations pursuant to N.C.G.S. § 160A-423 and Building Code sec. 105.10. However, we *697do not find that plaintiffs’ allegations state a claim upon which relief can be granted. Plaintiffs assumed occupancy in August 1985, in violation of N.C.G.S. § 160A-423 and Building Code sec. 105.10, before the city building inspector was requested to conduct the final inspection and had an opportunity to issue or deny the certificate of compliance.

As we have noted, plaintiffs elected to take title and assume occupancy of the townhouse in violation of the law before the building inspector had opportunity to make final inspection and issue a certificate of compliance. This act was an intervening, independent cause of plaintiffs’ damages. Therefore, the acts or omissions by the city building inspector did not proximately cause the plaintiffs’ damages.

We hold that the alleged violations of N.C.G.S. §§ 160A-417, -420, and -423 and North Carolina State Building Code secs. 105.4(f), 105.6, and 105.10 by defendants City Building Inspector J.R. Smith and the City of Asheville were not the proximate cause of the injury to the plaintiffs. Therefore, the trial court did not err in allowing defendants’ motion to dismiss pursuant to Rule 12(b)(6) of the North Carolina Rules of Civil Procedure with respect to plaintiffs’ claim against the City predicated on Inspector J.R. Smith’s willful and wanton conduct. We reverse that part of the Court of Appeals’ decision which holds that the trial court erred in dismissing plaintiffs’ complaint against the City with respect to the inspector’s willful and wanton conduct. In all other respects, the Court of Appeals’ opinion is affirmed.

Affirmed in part, reversed in part.