IBI, Spain — Wearing a top hat and surrounded by supporters mostly dressed in outlandish military uniforms, Vicente Candela stormed the town hall here briefly last month and proclaimed himself mayor of Ibi’s 24,000 residents.

It was, Mr. Candela said, “a coup d’état with humoristic violence,” over in about eight hours. He then handed power back to Ibi’s official mayor, while street cleaners removed the debris of a pitched battle between Mr. Candela’s rebels and his opponents, during which they pelted each other with flour and rotten eggs, amid the deafening noise of firecrackers.

This day of playful, ritualistic political upheaval is held in Ibi every Dec. 28, and traces its origins back as far as the role reversal in the Roman Empire’s festival of Saturnalia, when masters provided table service for their servants, according to José Vicente Verdú, a lawyer who has researched Ibi’s history.

But in modern Spain, the satire has been imbued with outsize significance as scores of corruption scandals have forced the ouster of several mayors and helped plunge support for Spain’s mainstream parties to record lows.