NEW YORK (AP) — New York City public housing tenants should be fingerprinted as a way of keeping criminals out of their buildings, Mayor Michael Bloomberg suggested Friday, adding that the buildings often had broken locks that allowed trespassers in.

His remark appeared offhanded, and the city is not working on a program that would have building doors only open by a resident’s fingerprint. But the comment, which comes just days after a key Bloomberg public safety measure was deemed unconstitutional, immediately drew criticism from several candidates battling to be City Hall’s next occupant.

Bloomberg, speaking during his weekly appearance on WOR Radio, was musing that a court decision this week to limit the police tactic known as stop-and-frisk may make it more difficult for officers to protect New York City Housing Authority buildings.

Bloomberg believes stop-and-frisk has driven down crime. Its critics say the measure — which allows police to stop people deemed acting suspiciously — unfairly discriminates against Black and Latinos, the same groups that make up the bulk of public housing residents.

Within an hour, mayoral hopeful Bill Thompson derided the fingerprinting idea as “disrespectful” and “disgraceful.”

“Just like stop-and-frisk, this is another direct act of treating minorities like criminals,” said Thompson, a former city comptroller, in a statement. “Mayor Bloomberg wants to make New Yorkers feel like prisoners in their own homes.”

Public Advocate Bill de Blasio, who has moved to the top of Democratic primary polls, called Bloomberg “out of touch” and urged the mayor to instead install security cameras within the buildings, which house more than 400,000 people.

Bloomberg’s spokesman later explained that the city is planning to install electronic key pads and key card locks on buildings to improve security. He also noted that fingerprint scan technology is becoming more common and is expected to be coming to smartphones.

The city is fighting U.S. District Judge Shira Scheindlin’s ruling imposing reforms on the NYPD’s stop-and-frisk policy. She also has ordered changes to an NYPD patrol program inside private buildings.