Two black men walked into a Starbucks in downtown Philadelphia on Thursday afternoon and sat down. Officials said they had asked to use the restroom but because they had not bought anything, an employee refused the request. They were eventually asked to leave, and when they declined, an employee called the police.

Some of what happened next was recorded in a video that has been viewed more than eight million times on Twitter and was described by the chief executive of Starbucks as “very hard to watch.” Details of the episode, which the authorities provided on Saturday, ignited widespread criticism on social media, incited anger among public officials and prompted investigations.

The video shows the men surrounded by several police officers wearing bicycle helmets in the Center City Starbucks. When one officer asks another man whether he is “with these gentlemen,” the man says he is and calls the episode ridiculous.

“What did they get called for?” asks the man, Andrew Yaffe, who is white, referring to the police. “Because there are two black guys sitting here meeting me?”