One of the central questions of political philosophy is what the purpose of government is. It is platitudinous to say that a good state is one that does (well) whatever governments should do, and it does nothing else. But this only makes it more pressing that we try to find out what governments should do--what their proper functions are, and are not--what, in the phrase of Wilhelm von Humboldt, their proper "spheres and duties" are.
We might be tempted to say, as nearly everyone can agree, that the purpose of the state is to protect rights and to preserve justice. But this raises more questions than it answers. Which and whose rights? What sort of justice? There are, after all, many different conceptions of what rights we have, and what justice consists of.
It is on those questions that one can find the differences between conservatism, liberalism, libertarianism, socialism, and fascism. There are a handful of anarchists (see anarchism) among the socialists (see traditional anarchism) and the anarcho-capitalists (see anarcho-capitalism). But everyone else agrees that the existence of some kind of government is morally justified. What they disagree about is what government should do.
One fairly useful way to conceive of the differences between these different views is as how much they want government to do. For a stark and timely contrast, consider two of these views: libertarianism, which wants the state to do only a few things, and socialism (except for anarchism), which wants the state to do a lot of things (but only as a transition to communism by some definitions of socialism). Libertarianism, in political theory, is the view that the function of the state is only to keep people from harming each other. In other words, an individual should be free to do anything they want, so long as they do not infringe upon the rights of others to do what they want. The government's role is to protect those rights. Socialism, nearly on the other end of a continuum, is the view that the state is responsible for an equitable distribution of wealth and for controlling the means of production and distribution of resources in an economy.
The constitutions of various countries codify practical views as to the purposes of their governments, but they tend to do so in rather vague terms, which particular laws, courts, and actions of politicians subsequently flesh out. For example, the Preamble of the United States Constitution lists the items states that the purpose of the Constitution--which defines the American state--is "to form perfect union, establish justice, insure domestic tranquility, provide for the common defense, promote the general welfare, and secure the blessings of liberty to ourselves and our posterity." The phrase "promote the general welfare" has, since the 1930s, been used to defend the proposition that the United States is tasked with creating a social "safety net," or welfare system; others, however, have disagreed that the phrase can be properly interpreted that way. But it is in this sort of way that various countries have translated vague talk about the purposes of their governments into particular state laws, bureaucracies, enforcement actions, etc.
Once we have given some justification for the existence of the state at all, we are faced with the question of what governments are morally justified in doing, which is another way of saying what their purposes or functions should be. This turns to be one of the most important questions that can be asked.