Section 94B. In an action for false arrest or false imprisonment brought by any person by reason of having been detained for questioning on or in the immediate vicinity of the premises of a merchant or an innkeeper, if such person was detained in a reasonable manner and for not more than a reasonable length of time by a person authorized to make arrests or by the merchant or innkeeper or his agent or servant authorized for such purpose and if there were reasonable grounds to believe that the person so detained was committing or attempting to commit a violation of section thirty A of chapter two hundred and sixty-six, or section twelve of chapter one hundred and forty, or was committing or attempting to commit larceny of goods for sale on such premises or larceny of the personal property of employees or customers or others present on such premises, it shall be a defense to such action.