A key part of the NYPD's controversial "stop and frisk" tactic has been ruled unconstitutional.

Manhattan Federal Court Judge Shira Scheindlin ordered police to refrain from making trespass stops outside private residential buildings — even though the landlord has given officers permission to do so as part of the NYPD's "Clean Halls" program.

"While it may be difficult to say when precisely to draw the line between constitutional and unconstitutional police encounters such a line exists, and the NYPD has systematically crossed it when making trespass stops outside buildings," Scheindlin wrote in a 157-page ruling.