An NBC4 I-Team undercover investigation has exposed rampant illegal behavior at Los Angeles public libraries.

For three months, I-Team hidden cameras captured scenes of drug use, lewd acts and other criminal activity at local branches that the head of the library system described as "shocking" and "disturbing."

At the Downtown Central Library, a man outside the building offered an undercover NBC4 I-Team producer what he said was crystal meth.

On other days, outside Hollywood’s Goldwyn Library, a building designed by famed architect Frank Gehry, NBC4’s hidden cameras captured people injecting what appeared to be heroin, as well as smoking what appeared to be crystal meth, crack cocaine and marijuana. One man our undercover producer met inside the library offered her what he said was the drug Ecstasy. Later that day, I-Team cameras captured the same man trying to steal a bicycle locked on the library fence.

NBC4 also found used syringes and condoms littering the ground in front of the Pio Pico branch in Koreatown.

KNBC-TV

The I-Team documented lewd behavior as well.

On one afternoon, NBC4 cameras rolled as a man masturbated next to the Goldwyn Libray book return box in broad daylight.

On another another day at Goldwyn, the I-Team documented a man sexually stimulating another man as children passed nearby.

"It’s shocking, it’s disturbing," said city librarian John Szabo when the I-Team showed him video of these incidents.

"It’s wrong," Szabo said, adding that families shouldn’t have to walk by criminal behavior on the way into the library.

KNBC-TV

"There’s always something going on," said Harriet Zaretsky, who lives in an apartment with a balcony that overlooks Goldwyn Library. "[It’s] either a drug deal, or a hooker..."

Zaretsky told the I-Team she’s complained to the library at least 20 times about illegal activity, but said she’s never seen library staff, police officers or security guards respond.

According to a memorandum of agreement signed by the Los Angeles Public Library (LAPL) and the Los Angeles Police Department, the LAPD is required to provide security "at and directly adjacent to the LAPL facilities."

The Library paid the LAPD $5,420,337 for security in 2017.

The LAPD is currently using the funds to provide the library with 10 police officers (on overtime shifts), 41 city security officers and 26 contract security officers at the Downtown Central Library and 72 branches.

But at the same time the I-Team observed people engaged in criminal activities at the Goldwyn, Durant and Downtown Central library branches, our cameras documented police officers spending much of their time texting on their cell phones or talking, instead of patrolling.

At the Downtown Central branch, at the same time a man was offering what he said was crystal meth to an undercover producer, NBC4 cameras documented one Los Angeles Police Officer who appeared to be sleeping.

When an undercover producer told officers she’d seen drug activity happening outside, an officer behind the Central branch security desk said he’d send an officer to investigate, but the I-Team never saw an officer dispatched.

"Our expectation absolutely is that [police officers] will be on the perimeter of the building, where these incidents occurred," said city librarian Szabo.

Szabo added he’d "absolutely" prefer to see police officers patrolling, instead of reading or texting.

NBC4 asked the LAPD to comment on the behavior documented by the I-Team’s hidden cameras.

"The Los Angeles Police Department is committed to protecting the city’s public spaces, and will work with our partners at the Los Angeles Public Library o ensure the environment in and around our libraries is safe and secure for patrons,” said an email from LAPD public information director Josh Rubenstein.

"Furthermore, any officer who violates department policy is subject to an internal administrative investigation," the email continued.

Los Angeles Police Chief Charlie Beck has agreed to an interview with NBC4 later this week to answer the I-Team’s questions about crime & safety issues at LA Public Libraries.

In 2016, Library staff filed 1077 "incident reports" for crimes on library property including theft, assaults, threats, public nuisance and vandalism.