Nearly two months after two black men were arrested at a Center City Starbucks while waiting for a friend, the Philadelphia Police Department on Friday announced a policy to determine when to arrest people accused of trespassing on private property.

The new policy encourages "greater discretion" from officers, who are now encouraged to deescalate disputes between business or property owners and an alleged offender. It also requires them to request a supervisor to respond to the location. The policy establishes that the offender must understand that he or she is not allowed on the property, and that the officer must witness the person's refusing to leave before making an arrest.

Officers are not allowed to arrest someone if the owner or authorized person did not personally communicate that the offender was unwelcome, or if the owner or authorized person refuses to file a trespassing complaint.

"The new policy provides officers with guidance on how to respond to calls about trespassing on private business properties that are open to the public," Police Commissioner Richard Ross — who had issued a public apology to the two men on April 19 — said in a statement Friday. "This allows police to take actions, with the help of their supervisor, that are most appropriate in each individual case."

The policy is intended to guide police responses to calls to investigate and enforce complaints of "defiant trespass," a Pennsylvania crime, ranging from a summary offense to a misdemeanor, in which someone enters or remains in a place where notice against trespassing has been given knowing he or she is not licensed or privileged to do so.

>>READ MORE: How can Starbucks atone? Hire more people with criminal records | Opinion

It stresses that officers cannot discriminate against someone based "on his or her race, ethnicity, color, sex, sexual orientation, gender identity, religion, national origin, ancestry, disability, marital status, familial status, or domestic or sexual violence victim status."

Facing mounting pressure, the Police Department was forced to reexamine its policies following the arrests April 12 of Rashon Nelson and Donte Robinson, who were waiting at a Starbucks at 18th and Spruce Streets for an acquaintance but didn't purchase anything. The video that showed their arrest was posted on Twitter by user Melissa DePino and viewed more than 10 million times. The arrest sparked national outrage and inspired conversations about racial profiling.

Nelson and Robinson reached a financial settlement with Starbucks last month and their records have been expunged.

"We've made a lot of progress and will continue to do so as we explore and implement new practices that reflect the importance of diversity, public safety, and accountability," Ross said Friday. In his statement, he also noted that the officers involved in the arrest — whom police have not publicly identified — "adhered to state-law mandates and did not violate department policy as it existed then."

At a news conference Friday at Police Headquarters, police spokesman Capt. Sekou Kinebrew said the new policy would take effect immediately. He said that only supervisors can make an arrest in response to a trespass, and that officers responding to a trespass call are required to alert a supervisor and an officer who has completed crisis intervention training.

"Our desired outcome is that no one gets hurt and no real harm is caused," Kinebrew said.

>>READ MORE: An unlikely outcome of Starbucks: Kindred spirits and a social media campaign

Officers were informed of the new policy May 30, Kinebrew said, voicing optimism about its impact. "It's always better to have more tools in your toolbox," he said.

The policy resulted from an internal investigation by the department, he said, adding that he was unaware whether similar policies exist at other major police departments.

Mayor Kenney applauded the Police Department's new policy.

"I view this policy as another positive step as our city learns and grows from the Starbucks incident," Kenney said in a statement. "As I said at the time of the incident, pain can lead to progress, and this new policy is an important milestone on that journey."

John McNesby, president of Fraternal Order of Police Lodge 5, said Friday that the officers involved in the incident had "acted professionally and with much respect," and that police would continue to do so under the new policy.

Tens of thousands of Starbucks employees around the nation spent May 29 in anti-bias training that was mandated by the Seattle-based company after the Philadelphia incident.

>>READ MORE: Starbucks bathrooms will be open to everyone after Philadelphia arrests

Interviewed Friday afternoon at the Starbucks at 18th and Spruce, Daniel Castro, 26, a musician who lives in Center City, spoke favorably of the new policy.

"In those kinds of minor cases, that a supervisor comes and analyzes the case before making a decision for arrest I think is a good thing," Castro said in Spanish, adding that he visits the store twice a week.

Staff writer Chris Palmer contributed to this article.