Christchurch's Papanui Library has pulled the plug on a "low-level torture device" aimed at stopping young people loitering outside.
The "mosquito device" had been emitting a high-pitched noise, generally only audible to under-25s, to deter youths that had been causing trouble.
Recently the library had started using the device during the day, which had stopped daytime intimidation and abuse but prompted complaints from local schools that it could discourage children from actually using the library.
The Council for Civil Liberties' Thomas Beagle questioned how it could be acceptable to use a device that deliberately hurt people to keep them out of a public place.
The library had chosen the wrong approach to the problem, he wrote in a posting on the council's website.
"Libraries should be places where children and teenagers are welcome, not excluded by deliberately making them uncomfortable."
This week the Christchurch City Council said it had turned the device off "while we undertake further investigation and evaluation", a spokeswoman said.
In 2010, the Council of Europe said the mosquito devices should be banned because they violated laws prohibiting torture.