NEW YORK (CBSNewYork/AP) — Mayor Bill de Blasio has signed a bill that will regulate where and how costumed characters operate in Times Square.

The City Hall ceremony Thursday morning capped a City Council effort to rein in aggressive panhandlers who have flooded the square, some harassing pedestrians for money. They included topless, body-painted women who caused a furor last summer.

READ MORE: New York City Teachers, Staff Face New Vaccine Deadline, But Some Look To Push Legal Battle To Supreme Court

The bill gives the city’s Department of Transportation power to create restricted zones for costumed characters and others to keep them from blocking pedestrians in the traffic-free parts of the square. The legislation also gives the DOT control over pedestrian plazas throughout the city.

De Blasio said the new law “will ensure that our pedestrian plazas remain vibrant, safe spaces for all New Yorkers by formalizing the DOT’s authority to designate and regulate these spaces.”

The council approved the legislation earlier this month.

Councilmember Corey Johnson, the bill’s main sponsor, said the measure will preserve Times Square’s character.

READ MORE: PHOTOS: 74th Annual Tony Awards Red Carpet

“It encapsulates New York’s energy, it’s scale, it’s diversity, it’s quirkiness, and in a good way I think it’s craziness,” Johnson said.

The move came after numerous complaints from pedestrians about aggressive panhandling, fights over tips and even arrests.

In the most recent incident, a man in a Spider-Man costume was accused of fighting with a tourist over a tip last month and was arrested on an assault charge.

Other incidents included a Spider-Man allegedly punching a police officer, an Elmo being arrested for allegedly harassing people and yelling anti-Semitic slurs and a “Toy Story” Woody allegedly groping women.

The Department of Transportation hopes to have the zones in place by the summer.

MORE NEWS: Activists Again Call For Getting Carriage Horses Off NYC Streets Following Injury

(TM and © Copyright 2016 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2016 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.)