This left Tancítaro without police or a government, whose officials had fled. Power accumulated to the militias that controlled the streets and to their backers, an organization of wealthy avocado growers known as the Junta de Sanidad Vegetal, or Plant Health Council. Citizens sometimes call it the Junta.

Nearly four years in, long after other militia-run towns in Michoacán collapsed into violence, the streets remain safe and tidy. But in sweeping away the institutions that enabled crime to flourish, Tancítaro created a system that in many ways resembles cartel control.

Their rule began with a purge. Young men suspected of involvement in the cartel were expelled. Low-level runners or informants, mostly boys, were allowed to stay, though the cartel murdered most in retaliation, a militia commander said.

Though violence eventually cooled, the wartime power structure has remained. The militias now act as the police, as well as guards for the town perimeter and the avocado orchards.

Cinthia Garcia Nieves, a young community organizer, moved into town shortly after the fighting subsided. Idealistic but clear-minded, she wanted to help Tancítaro develop real institutions.

But lines of authority had “blurred,” she said in a cafe near the town center.

Ms. Nieves set up citizens’ councils as a way for local families to get involved. But militia rule has accustomed many to the idea that power belongs to whomever has the guns.

She has high hopes for community justice forums, designed to punish crimes and resolve disputes. But, in practice, justice is often determined — and punishments administered — by whichever militia commander chooses to involve himself.