The chief executive of Starbucks apologized Saturday to two black men arrested at a Philadelphia store in an incident that has led to accusations of racial profiling by the company and police.

In a statement to Starbucks customers and employees Saturday, CEO Kevin Johnson acknowledged “a disheartening situation in one of our Philadelphia-area stores this past Thursday, that led to a reprehensible outcome.”

Cellphone videos captured the tense moment Thursday afternoon when at least six Philadelphia Police Department officers stood over two seated black men, asking them to leave. A man named Andrew Yaffe arrives to tell police that the two men were waiting for him. The officer says that they were not complying and were being arrested for trespassing.

“Why would they be asked to leave?” Yaffe says. “Does anybody else think this is ridiculous?” he asks people nearby. “It’s absolute discrimination,” Yaffe adds. The two unidentified men are taken out in handcuffs soon after. They were released early Friday with no charges filed.

One of the videos of the arrest rocketed across social media, with 4.5 million views by Saturday evening.

Lauren Wimmer, the attorney for the two men, told The Washington Post that her clients told a Starbucks employee that they were waiting for Yaffe. Shortly after, a white female employee called the police, Wimmer said.

Wimmer said Yaffe, who runs a real estate development firm, said that he was there to meet the men to discuss business investment opportunities.

The two men, whom she declined to identify, were taken to a police station, fingerprinted and photographed. One officer suggested that they faced charges for “defiant trespassing,” Wimmer said. They were held for nearly nine hours before they were released, she said, after prosecutors said they would not pursue charges.

Benjamin Waxman, a spokesman for Philadelphia District Attorney Larry Krasner, said the office decided that there “wasn’t sufficient evidence to charge [the men] with a crime.”

In his statement, Johnson said the video was hard to watch and that he hopes to meet the two men to offer “a face-to-face” apology, adding that the company’s practices and training “led to a bad outcome — the basis for the call to the Philadelphia police department was wrong.”

“Our store manager never intended for these men to be arrested and this should never have escalated as it did,” Johnson said.

Johnson said the company would conduct an investigation and make “any necessary changes to our practices that would help prevent such an occurrence from ever happening again.”

Earlier in the day the company tweeted a statement apologizing to the two men and said it was “disappointed this led to an arrest.”

After the arrest, the police were also being criticized for their handling of the situation. Police Commissioner Richard Ross addressed the incident on Facebook Live on Saturday, saying that one or both of the men asked to use the restroom but had not purchased anything. An employee said Starbucks company policy was to refuse use of the bathrooms to non-customers and asked the men to leave, according to Ross. The employee called the police when they refused.

“These officers did absolutely nothing wrong. They followed policy; they did what they were supposed to do. They were professional in all their dealings with these gentlemen,” Ross said. “And instead, they got the opposite back.” Ross said police arrested the men after they refused three requests to leave.

Ross, a black man, said he was aware of issues of implicit bias — unconscious discrimination based on race — but did not say whether he believed it applied in this case. He said the incident underscores the need for more body-worn cameras to present different perspectives of police responses. The officers were not wearing cameras, he said.

At least two cellphone videos captured the incident.

The police department said Thursday that it was investigating and would comment once more facts were known. It was not immediately clear whether Ross’s statement means the investigation has concluded.

Starbucks does not have a companywide policy on asking members of the public to leave, said the company official.

The company leaves safety and customer service protocol decisions up to store managers, said a company official familiar with the incident, who declined to give a name to freely describe internal discussions. They may leave restroom doors unlocked or add key code entries if they feel the store is more at risk for criminal behavior. A store in the same area of Philadelphia experienced an armed robbery recently, the official said.

The Starbucks official acknowledged that the incident is at odds with what many people have done at a Starbucks without drawing suspicion or calls to police. The stores are “community” hubs, the official said, where people often drop in to use the WiFi or chat with friends without necessarily ordering anything.

Wimmer said she spent a good portion of her time in law school in Starbucks without buying much and never had a problem as a white woman.

The incident was about race, Wimmer said. She suggested an experiment: Go to a Starbucks and assess the demographics of people sitting there.

“Who is the manager going to call and say, ‘Please leave?’ ” she asked.

Read more:

America’s first black billionaire says Trump economy has been good for African Americans

This billionaire toy executive has a last-ditch mission to save Toys R Us, before it’s too late