Video

In less than three minutes, a comedy routine between Hillary Clinton and Mayor Bill de Blasio of New York managed to cause a storm of controversy over a racially charged joke.

It happened on Saturday night when Mrs. Clinton made a surprise visit to the Inner Circle dinner, an annual black-tie event that brings together the city’s press corps, lobbyists and lawmakers. She strode onstage with Mr. de Blasio and Leslie Odom Jr., the actor who plays Aaron Burr in the hit musical “Hamilton.”

“Thanks for the endorsement, Bill,” Mrs. Clinton said to Mr. de Blasio, a former aide to Mrs. Clinton when she was a senator from New York who nonetheless dallied in supporting her. “Took you long enough.”

“Sorry, Hillary,” Mr. de Blasio said. “I was running on C.P. time,” a reference to the stereotype “Colored People Time,” which drew some cringes from the audience.

Mr. Odom, who is black and appeared to be in on the joke, interrupted: “That’s not — I don’t like jokes like that, Bill.”

Mrs. Clinton jumped in. “Cautious politician time. I’ve been there,” she said.

The joke quickly made its way around social media as both Mrs. Clinton and Senator Bernie Sanders work to woo black voters ahead of the April 19 primary in New York. Both Mr. de Blasio and Mrs. Clinton have a reputation for running late, but the expression struck some as inappropriate.

New York magazine captured the exchange and asked “Does your wife, Chirlane, know about this joke?” referring to Mr. de Blasio’s wife, Chirlane McCray, who is African-American. Salon called the comedy skit “cringe worthy.” A headline in Gawker read “Hillary Clinton Tries to Prove She’s Not Racist with Awkward Joke About ‘Colored People Time.’”

Speaking on CNN on Monday evening, Mr. de Blasio said that the exchange was part of a scripted event and that all parties were in on the joke, with “cautious politician” being the intended punchline.

“I think people are missing the point here,” he said.

The joke came just days after Bill Clinton clashed with Black Lives Matter protesters who accused him of advancing policies during his administration that hurt African-American communities. A day later, the former president said he “almost” wanted to apologize to the activists.

Mrs. Clinton has overwhelmingly won the support of black voters and will be counting on them again next week in New York.