She added: “The parents don’t want them, the library doesn’t want them, so they act out.”

That leaves librarians doing a job they did not sign up for: baby-sitting for kids old enough to baby-sit.

The Maplewood library has created a gallery space for young people’s artwork, put on an anime film festival and formed a Teen Advisory Group that attracted 30 youngsters for a recent pizza party.

But problems persisted.

In consultation with a lawyer, the library board came up with behavior guidelines in May 2005 that prohibited activities like “hairdressing or grooming of another person” and “refusal to leave the building.” The policy includes some politely precise language common to those who speak softly from behind a reference desk: “If a patron seems to be placing a staff member in the position of providing a nonlibrary-related function, the staff member may bring the interaction to a prompt conclusion.”

But library officials felt that a bigger stick was needed. Last week, the board posted a notice on its Web site and library doors saying it had “struggled with this problem for over 10 years” and voted “with great reluctance” on Dec. 20 to close after school.

“Having as many as 50 young people with nothing to do creates an untenable situation,” read the note, which pointed out that many students did not use library resources but simply socialized in the building. “It interferes with patrons of all ages who want to use the library and with the staff members who are there to serve them. The library can no longer deal with large numbers of students who come after school and wait, sometimes into the late evening, to be picked up.”

The decision has not been popular in town. In a posting on Maplewoodonline.com, the community’s Internet bulletin board, one resident, Joan Crystal, said an alternative needed to be developed before closing the library. “I also think it improper to close the library during hours when adults, older students and M.M.S. students find it most convenient to use the library,” she wrote.

David Huemer, who represents the Maplewood Township Committee on the library board, said he would like to see the current police station, which is being retired in favor of a new one, converted to a youth center.