(CNN) - Bernie Mac made a surprise appearance at a Barack Obama fundraising event Friday evening - but given heckling from the crowd and a rebuke from the Illinois senator's campaign for an off-color joke, the comedian may wish he'd just stayed home.
Introducing Obama at the high-dollar fundraising event in Chicago, Mac delivered a 10-minute standup routine during which he joked about sexual promiscuity and referred to women as "hos."
"My little nephew came to me and he said, 'Uncle, what's the difference between a hypothetical question and a realistic question?"' Mac said toward the end of his routine. "I said, I don't know, but I said, 'Go upstairs and ask your mother if she'd make love to the mailman for $50,000."'
"Hypothetically speaking, we should have $100,000. But realistically speaking we live with two hos," Mac said, delivering the joke's punchline.
Some attendees of the $2,300 per-person event immediately registered their displeasure with Mac's joke, and asked that he leave the stage.
"It's not funny. Let's get Barack on," one man shouted.
Mac introduced the Democratic presidential candidate shortly after and Obama called the comedian a "great friend." The Illinois senator also joked that Mac needs to "clean up [his] act."
"We can't afford to be divided by race. We can't afford to be divided by region or by class and we can't afford to be divided by gender, which by the way, that means, Bernie, you've got to clean up your act next time," he said. "This is a family affair. By the way, I'm just messing with you, man."
But the campaign issued a statement shortly after the event that was decidedly more serious in its condemnation of Mac's comments.
"Senator Obama told Bernie Mac that he doesn't condone these statements and believes what was said was inappropriate," campaign spokeswoman Jen Psaki said.