While all the actors improvised lines in the studio, Cohen -- who voices King Julien, king of the lemurs -- was the recording booth cutup.
"We gave him one little line and he would just go off on it for eight or 10 minutes, which was just the funniest thing you'd ever hear," says writer/director Tom McGrath.
"When they're all hiding in the bushes, and Julien's going, 'Shh, we're hiding. Who's making that noise? Oh, it's me again.' That was all on the fly.
"There's no time in the film to put it all in, and sometimes it would go off into areas where maybe you couldn't go, but it was always really entertaining and stretched the boundaries," McGrath says.
Dreamworks' latest animated movie revolves around four born and bred New York animals who escape from the Central Park Zoo for a night on the town.
They quickly find themselves being shipped back to their ancestral lands after their shenanigans.
A disaster at sea maroons them on Madagascar, where they're unsure (like many New Yorkers) with how to cope with country living.