The State is the mafia with a flag.
Why does the mafia exist?
To control territory, monopolize resources, enrich and protect an artificially privileged elite, exploit subjects, and expand its own realm of power and domination.
When a gang’s territory is threatened, it responds with extreme violence.
How is that different from what states do or have ever done?
Max Weber defined the state as an institution claiming an exclusive right to engage in violence (in other words, actions that would be considered criminal if anyone did them).
Criminal organizations have their own internal codes and ceremonies that are used to maintain cohesion and convey a sense of legitimacy and identity to the organization.
This is what States do as well. All states maintain some kind of self-legitimating ideology. An Egyptian pharaoh may claim to be descended from the sun-god. A medieval monarch may invoke the divine right of kings. A theocracy may claim religious legitimacy. A liberal democratic state’s legitimating ideology is a hybrid of Lockean property theory and the Rousseauan notion of the general will. A Communist regime claims to be a workers state. Other states may claim legitimacy by appealing to tradition, the glory of the fatherland, ethnic kinship, or racial or national superiority.
But ultimately, these abstractions are manipulated and bended into a shape that matches the interests of the existing power elite.