(a) A person commits the offense of loitering if he or she:
(1) Lingers, remains, or prowls in a public place or the premises of another person without apparent reason and under circumstances that warrant alarm or concern for the safety of persons or property in the vicinity and, upon inquiry by a law enforcement officer, refuses to identify himself or herself and give a reasonably credible account of his or her presence and purpose;
(2) Lingers, remains, or prowls in or near a school building, not having any reason or relationship involving custody of or responsibility for a student and not having written permission from anyone authorized to grant permission;
(3) Lingers or remains on a sidewalk, roadway, or public right-of-way, in a public parking lot or public transportation vehicle or facility, or on private property, for the purpose of asking for anything as charity or a gift:
(A) In a harassing or threatening manner;
(B) In a way likely to cause alarm to another person; or
(C) Under circumstances that create a traffic hazard or impediment;
(4) Lingers or remains in a public place for the purpose of unlawful gambling;
(5) Lingers or remains in a public place for the purpose of engaging or soliciting another person to engage in prostitution or deviate sexual activity;
(6) Lingers or remains in a public place for the purpose of unlawfully buying, distributing, or using a controlled substance;
(7) Lingers or remains in a public place for the purpose of unlawfully buying, distributing, or consuming an alcoholic beverage;
(8) Lingers or remains on or about the premises of another person for the purpose of spying upon or invading the privacy of another person; or
(9) Lingers or remains on or about the premises of any off-site customer-bank communication terminal without any legitimate purpose.
(b) Among the circumstances that may be considered in determining whether a person is loitering are that the person:
(1) Takes flight upon the appearance of a law enforcement officer;
(2) Refuses to identify himself or herself;
(3) Manifestly endeavors to conceal himself or herself or any object; or
(4) Has acted in a harassing or threatening manner or in a way likely to cause alarm to another person after sunset or before sunrise.
(c) Unless flight by the actor or another circumstance makes it impracticable, prior to an arrest for an offense under subdivision (a)(1) of this section a law enforcement officer shall afford the actor an opportunity to dispel any alarm that would otherwise be warranted by requesting the actor to identify himself or herself and explain his or her presence and conduct.
(d) It is a defense to a prosecution under subdivision (a)(1) of this section if:
(1) The law enforcement officer did not afford the defendant an opportunity to identify himself or herself and explain his or her presence and conduct; or
(2) It appears at trial that an explanation given by the defendant to the law enforcement officer was true and, if believed by the law enforcement officer at that time, would have dispelled the alarm.
(e) Loitering is a Class C misdemeanor.