A bill in the state Legislature aims to protect students' right to learn by having access to library materials amid calls to remove certain materials from schools and libraries.

Advocates and educators testified in support of the bill Wednesday, saying no one in Massachusetts should be barred from exploring books. The bill would ensure decisions about book selection or removal are based on educator's professional training and not personal, partisan or doctrinal beliefs.

"Books and materials are our most compelling windows into the myriad of human experience and they capture the breadth of knowledge,” said state Sen. Julian Cyr, D-Cape and Islands. “And we cannot allow small, minded bands or politically opportunistic censorship interfere with the right to read."

According to the American Library Association, Massachusetts had 45 attempts to censor books and other library resources in 2022 — the fourth highest number of any state.

Last month, police in Great Barrington searched an eighth-grade classroom for the book "Gender Queer" after someone complained it contained pornographic images.