The Broadway legend Mandy Patinkin said Friday he was canceling a plan to join the cast of “Natasha, Pierre & the Great Comet of 1812” after an uproar on social media over the fact that the show brought in Mr. Patinkin, who is white, to replace an African-American actor, Okieriete “Oak” Onaodowan.

“My understanding of the show’s request that I step into the show is not as it has been portrayed and I would never accept a role knowing it would harm another actor,” Mr. Patinkin said. “I hear what members of the community have said and I agree with them. I am a huge fan of Oak and I will, therefore, not be appearing in the show.”

The statement, which Mr. Patinkin emailed to The New York Times on Friday afternoon, came after a tumultuous two days for the show, which had been trying to stabilize its finances after the departure of Josh Groban from the leading role of Pierre. It was not immediately clear what would happen now — Mr. Onaodowan had said Friday morning he would leave the cast Aug. 13.

The show’s producers and creative team were clearly blindsided by the turn of events. They had previously asked another performer, Brittain Ashford, to take a leave during the summer so she could be replaced by a well-known singer-songwriter, Ingrid Michaelson, and did not anticipate that replacing Mr. Onaodowan with Mr. Patinkin would be seen differently.