Anthony Anderson as Dre in ABC’s “Blackish.” (Byron Cohen/ABC)

Troubled R&B singer Chris Brown made a guest appearance on Wednesday’s episode of “Blackish,” playing a rapper brought in to collaborate on a campaign with Dre (Anthony Anderson) and his advertising firm.

Many fans expressed disappointment with the ABC sitcom’s decision to cast Brown in the guest role, which was first reported by Entertainment Weekly. “Blackish,” now in its third season, has tapped a number of celebrities to guest star including Tyra Banks, “Hamilton” actor Daveed Diggs and Rashida Jones, slated to appear  as Dre’s sister-in-law in an episode next month. But Brown, whose award-winning career has often been overshadowed by repeated run-ins with the law, was a rather unexpected choice.

In 2009, Brown pled guilty to a felony charge for assaulting his then-girlfriend Rihanna. He was arrested last August after an hours-long standoff with the police that began when a woman called 911 from outside Brown’s Southern California home, where she said he had threatened her with a gun. Brown has been back in the headlines recently, amid reports that his ex-girlfriend, model Karrueche Tran, obtained a restraining order against the singer. Earlier this month, Billboard magazine ran an article attributing Brown’s “downward spiral” to drug addiction and anger issues — claims he later refuted on social media.

For some “Blackish” fans, Brown’s legal issues seem at odds with the thoughtful social commentary often seen on the show. Some pledged to skip the episode altogether, while others urged the sitcom to address domestic violence issues.

Brown’s screen time amounted to little more than five minutes and the singer was noticeably absent from images shared by the show’s official social media accounts. His character, Rich Youngsta, sang and danced his way through an ad for a sparkling beverage called Uvo. The campaign (slogan: put some Uvo on it) presented the drink as a way to instantly upgrade anything from pancakes to jewelry.

Dre’s colleagues loved the ad, but he received a less positive review from his wife, Rainbow (Tracee Ellis Ross) and mother, Ruby (Jenifer Lewis), who were concerned the ad played on stereotypes of black people. They took particular issue with a scene that found Rich Youngsta pouring Uvo on an annoyed-looking black woman, instantly upgrading her to a cheerful white woman.

That criticism led to a debate about representation and the responsibility that black people in creative fields (from advertising to film and television) have to their community. Dre decided to take a “more tasteful and elegant” approach to the ad after seeing his young son Jack mimic the original campaign’s misguided slogan.

Ultimately, the episode did have a worthwhile message, but it had nothing to do with Brown or his character. Brown maintains a loyal fanbase and did receive some praise for his performance on social media, but Rich Youngsta, for all intents and purposes, could have been played by another entertainer.

ABC declined to comment on Brown’s appearance ahead of Wednesday’s episode. But Anderson, who is also an executive producer on “Blackish,” shed some light on how Brown landed the role in a recent interview with Gold Derby. The actor explained that Brown had approached creator Kenya Barris at a restaurant to tell him that he was a fan of the show and would love to guest star.

“People are going to be pleasantly surprised when this episode airs,” Anderson added.

Related:

‘Blackish’ dissects Trump’s win and finds the humanity in our political discord

How ‘Blackish’ tackled police brutality while staying true to its roots

Chris Brown bailed out of jail following hours-long police standoff that ended in his arrest