The two main theorems of welfare economics show why free markets are great: a market equilibrium is pareto-optimal and vice versa.
The problem is that the conditions under which these theorems holds are completely unrealistic: perfect competition (which is predicated on decreasing economies of scale), so no monopolies, perfect information, no externalities, no public goods, etc.
Given that, it is imperative to regulate markets, and provide some goods through the public sector.