Cannabis and money have been found in the lockers of the members of an elite detective squad and above a false ceiling in their office building in the northern district of the southern French city, prosecutor Jacques Dallest said.
The officers were arrested on Tuesday. They are suspected of having stolen drugs and cash from dealers and of holding on to cigarettes confiscated from illicit sellers.
Dallest said secretly recorded conversations in their official vehicles were "very revealing" and suggested the alleged corruption could have involved more officers than those in court on Friday.
"The feeling is that gangrene has taken hold of this service," the prosecutor said.
Friday's court hearing was to decide whether the 12 officers should face charges, be detained in custody pending further investigation or released.
If charges are brought, the Marseille affair will be the second major corruption case to hit the French police in little over a year.
Michel Neyret, the former deputy police chief of Lyon who was hailed for cutting drug crime and jewellery heists, is currently under house arrest awaiting trial on charges of accepting gifts and favours from members of the city's underworld.
French Prime Minister Jean-Marc Ayrault last month announced beefed up security with 205 extra police to tackle deadly gang violence in Marseille following a wave of underworld shootings.
He also announced the creation of a new security zone in the city's southern quarters.
The Mediterranean port of some 850,000 residents, long known as a hotbed of crime, has been struck by a wave of shootings with assault rifles in turf wars over the lucrative illegal drug trade.
A district mayor had urged the government to take drastic steps, even appealing for the army to be sent in, but the call was rejected quickly by senior officials.