When the building official determines that any building is being constructed, altered, or modified; or any land is being used in violation of this chapter; and in his or her judgment immediate cessation of such construction, alteration, or modification of buildings; or use of land is required to prevent harm to any person, firm, corporation, or public agency; or to preserve the status quo; he or she may issue a stop work order in writing to the responsible party. The building official may also revoke any building permit or certificate of occupancy for any land, building or use in violation of this chapter to protect public health, safety and welfare.