Contrary to common view, civil wars are not situations of lawlessness, but of competition between legal systems. This presentation draws on sociological approaches to law and the State to consider the establishment of courts by an armed movement. Through a field study conducted between 2010 and 2016, I examine the social and political implications of the formation of a legal system by the Taliban insurgency in Afghanistan. In a context where dispensing justice is indissociably a legal activity, an instrument of social control and a weapon in the war, how can an armed movement ensure that the decisions of its judges are recognised as legal rather than political acts? In other words, how did the Taliban judge, who was as much Taliban as he was a judge, manage to gain public recognition for his role? While the international coalition created an inadequate legal system undermined by corruption, the Taliban set up hundreds of courts in the countryside: by insisting on the respect of procedures, the impartiality of judges and the enforcement of verdicts, this system of justice established itself as one of the rare sources of predictability in the daily lives of Afghans. ‘The Taliban court is for everyone, but the government court is only for the rich’, a resident of Wardak province told me. How does an armed movement gain the trust of the population? How does it put itself in a position to regulate social relations? And with what consequences for society?