Testifying in federal court Wednesday at a hearing in a lawsuit seeking to stop the police practice of arresting people seen leaving apartment buildings, NYPD Inspector Kerry Sweet said in early July he met with officials from all five city’s district attorney’s offices to discuss new training and operational changes for the program formerly called “Operation Clean Halls.”

Sweet said he returned from his summer vacation in August to find a letter dated July 18 from Bronx prosecutor Jeannette Rucker on his desk. Rucker, who was at that meeting, wrote that after investigating complaints about the arrests of “legitimate tenants or guest” under the program, her office was now requiring that prosecutors interview police officers before prosecuting their trespass cases. In the past, prosecutors relied on written officer statements. Since the new policy was implemented, Rucker tesified Tuesday, there has been a drastic fall off in “Clean Halls” arrests

“I was surprised,” Sweet said. “I had met with the group of district attorneys (including Rucker) earlier in July and none of the concerns raised in the letter were discussed at that time.”

Because of her letter, Rucker has emerged as a key figure in a lawsuit filed by the New York Civil Liberties Union and community and legal organizations seeking to stop trespassing arrests made outside privately-owned buildings whose landlords have signed up for the NYPD program. The lawsuit is the first of three being heard by Justice Shira Scheindlin that challenges stop-and-frisk tactics employed by city police.

Sweet, a supervisor in the NYPD’s Legal Bureau, said that beginning in 2010 he spearheaded NYPD efforts to bring uniformity to two police operations that focus on what are known as “vertical patrols” of the stairways and other areas in troubled public and private apartment buildings.

At that time, the district attorneys’ offices had different standards for what they required in documentation for the arrests and the forms cops needed to fill out varied from precinct to precinct, he said. It took two years to achieve “uniformity across the board” in the police department and the five district attorneys’ offices, Sweet said.

During that time, Sweet said, he found Rucker — who testified in the case earlier this week — frustrating to work with. ”She tends to change her mind quite frequently,” he said.

The inspector said that Rucker originally agreed to change her office’s requirement to notarize the landlord agreements to participate in the program because it was too onerous for the police to do so. Later, she changed her mind, requiring notarization again. Then she changed her mind again, Sweet said.

“It’s difficult to keep up with her changes,” Sweet said.

Rucker could not be reached for comment Wednesday night.

Sweet did credit Rucker for raising concerns about the trespassing programs that were later incorporated into training programs. The inspector said he ageed with one of her biggest complaints, that people who police only see exiting buildings shouldn’t be arrested for trespassing.

But Sweet said he disagreed with Rucker about her stance that people found inside vestibules were not technically inside the building and shouldn’t be arrested for trespassing.

“A vestibule of a building, the outer area of a building, is still private property and therefore an arrest would be proper,” he said.