Section 19. If a tenant or occupant of a building or tenement, under a lawful title, uses such premises or any part thereof for the purposes of prostitution, assignation, lewdness, illegal gaming, or the illegal keeping or sale of alcoholic beverages, as defined in section one of chapter one hundred and thirty-eight, or the housing of a premises which is licensed under section twelve of said chapter one hundred and thirty-eight and on or in such premises alcoholic beverages are habitually served to persons who are intoxicated or alcoholic beverages are served to persons whom the operators of said premises know or have reason to know will operate a motor vehicle under the influence of intoxicating liquor in violation of subdivision (1) of section twenty-four of chapter ninety, or the illegal keeping, sale or manufacture of controlled substances, as defined in section one of chapter ninety-four C, or the illegal keeping of a weapon in violation of section ten of chapter two hundred and sixty-nine, or possession or use of an explosive or incendiary device or other violations of section one hundred and one, one hundred and two, one hundred and two A or one hundred and two B of chapter two hundred and sixty-six or, if a tenant or household member of a housing authority or federal or state assisted housing commits an act or acts which would constitute a crime involving the use or threatened use of force or violence against the person of an employee of the housing authority or of state or federally assisted housing or against any person while such person is legally present on the premises of a housing authority or on the premises of federal or state assisted housing, such use or conduct shall, at the election of the lessor or owner, annul and make void the lease or other title under which such tenant or occupant holds possession and, without any act of the lessor or owner shall cause the right of possession to revert and vest in him, and the lessor or owner may seek an order requiring the tenant to vacate the premises or may avail himself of the remedy provided in chapter two hundred and thirty-nine. If the lessor or owner is entitled to relief pursuant to this section, such lessor or owner may seek declaratory judgment of his rights hereunder in the district, superior or housing court, which may grant appropriate equitable relief, including both preliminary and permanent injunctions, including a preliminary injunction granting the lessor or owner possession of the premises, and in connection therewith may order issuance of an execution for possession of any such premises to be levied upon forthwith. No such injunction shall be issued except after notice has been given to the tenant and a hearing has been held with opportunity for the tenant to confront and cross-examine witnesses and to present any legal or equitable defense. A housing authority or provider of state or federally assisted housing shall not avail itself of the remedies contained herein except after notice, hearing, and decision on the merits by the court. An appeal from equitable relief granted by a district court pursuant to this section shall be to the appeals court in the same manner as if relief had been granted by the superior court.