Starbucks on Sunday apologized after an employee at one of its stores in Tempe, Arizona, asked six police officers to leave or move out of a customer's line of sight, triggering social media backlash.

The officers had visited the store on July 4 and had paid for the drinks, before one company employee approached them about a customer not feeling safe because of the police presence, the Tempe Officers Association said on Twitter.

"This treatment of public safety workers could not be more disheartening. While the barista was polite, making such a request at all was offensive," the association added.

Following the incident, users took to Twitter to support the police, tweeting comments along with the #boycottstarbucks hashtag.

In an apology addressed to the Tempe Police Department and posted on its website, Starbucks said the treatment of the officers was "completely unacceptable."

"On behalf of Starbucks, I want to sincerely apologize to you all for the experience that six of your officers had in our store on July 4," Rossann Williams, the coffee chain's executive vice president, wrote.

"What occurred in our store on July 4 is never the experience your officers or any customer should have, and at Starbucks, we are already taking the necessary steps to ensure this doesn't happen again in the future."

Last year, the company was mired in a racial profiling incident that involved the arrest of two black men in a Philadelphia store. Starbucks later settled with the men privately, and temporarily closed 8,000 U.S. stores for anti-bias training.