An element of the New York Police Department’s stop-and-frisk practice was deemed unconstitutional by a federal judge on Tuesday, a ruling that may have broad implications for the city’s widespread use of police stops as a crime-fighting tactic.

The decision, the first federal ruling to find that the practice under the Bloomberg administration violates the Fourth Amendment protection against unreasonable search and seizure, focused on police stops conducted in front of several thousand private residential buildings in the Bronx enrolled in the Trespass Affidavit Program. Property managers in that program have asked the police to patrol their buildings and to arrest trespassers.

But the judge, Shira A. Scheindlin of Federal District Court in Manhattan, said officers were routinely stopping people outside the buildings without reasonable suspicion that they were trespassing.

“While it may be difficult to say where, precisely, to draw the line between constitutional and unconstitutional police encounters, such a line exists, and the N.Y.P.D. has systematically crossed it when making trespass stops outside TAP buildings in the Bronx,” Judge Scheindlin ruled.

Judge Scheindlin is presiding over three significant stop-and-frisk lawsuits that could fundamentally change New York City’s strategy for preventing street crimes. While the judge’s decision applies to only one of the lawsuits, Ligon v. the City of New York, the cases share some core constitutional issues.

Much of the criticism in the ruling is directed at the training the Police Department provides officers, which Judge Scheindlin suggested sidesteps the Fourth Amendment.

The evidence in this case, she found, “strengthens the conclusion that the N.Y.P.D.’s inaccurate training has taught officers the following lesson: Stop and question first, develop reasonable suspicion later.”

Christopher T. Dunn, a lawyer for the New York Civil Liberties Union, one of the groups representing the plaintiffs, said, “If New York City has any sense, it will use this ruling as an opportunity to start a wholesale reform of stop and frisk.”

In the decision released on Tuesday, the judge ordered the police “to cease performing trespass stops” outside the private buildings in the program unless officers have reasonable suspicion, a legal standard that requires officers to be acting on more than just a hunch.

The fact that a person was merely seen entering or leaving a building was not enough to permit the police to stop someone, “even if the building is located in a high-crime area, and regardless of the time of day,” the judge ruled. Nor was it enough for an officer to conduct a stop simply because the officer had observed the person move furtively, Judge Scheindlin said. (The forms that the police fill out after each street stop offer “furtive” movements as a basis for the stop.)

The police commissioner, Raymond W. Kelly, criticized the ruling, contending that the program, also known as Clean Halls, gave residents of the Bronx buildings “a modicum of safety for less prosperous tenants. Their landlords explicitly requested this extra level of protection.”

“Today’s decision unnecessarily interferes with the department’s efforts to use all of the crime-fighting tools necessary to keep Clean Halls buildings safe and secure,” he added.

Paul J. Browne, the department’s chief spokesman, said the program led to several recent arrests for illegal guns. On Dec. 16, the police arrested a man with a handgun on the rooftop of a residential building in the Bronx.

On Nov. 21, officers recovered a handgun after observing the gun’s butt protruding from a man’s jacket pocket as they patrolled a fourth-floor hallway in a building on East 220th Street.

Judge Scheindlin called for a hearing to discuss possible remedies to the issues she raised. At that hearing, she said, she will consider requiring the Police Department to create a formal written policy “specifying the limited circumstances in which it is legally permissible to stop a person outside a TAP building on a suspicion of trespass,” revise the training of officers and alter some of the training literature and videos used to teach officers how to conduct lawful stops.