If free markets never fail, there's no inherent need for government intervention, though we might object to the resultant wealth distribution on moralistic grounds. But if markets do occasionally fail, then it's possible that government intervention could be used to realign incentives, and "nudge" the market to a higher order equilibrium.
View From An Ivory Tower
Neoclassical economists believe that only a few types of market failures are possible, no matter how often reality disagrees. In particular, neoclassical economists reject the idea that coordination failures can occur. A coordination failure can be roughly described as a scenario where each individual in a group acts in a way that maximizes its own expected outcome, but by doing so fails to maximize the expected outcome of the group. You might ask, how is it possible for everyone to do their best and still reach an outcome that is inferior to some other outcome? The answer is: a failure to coordinate. That is, just because everyone does their best individually does not imply that the group as a whole will do its best collectively. This is a very simple concept with a lot of intuitive appeal. Yet, neoclassical economists reject coordination failures as a possibility, since they argue that if it is profitable for coordination to occur, it will. That also has a lot of intuitive appeal, which is why that theory stuck around for so long. But neoclassical theory doesn't describe the world we live in, which is filled with crooks, liars, and idiots. It describes an idealized world where people can overcome their short-term expectations and desires, collaborating whenever it's profitable, inadvertently advancing the greater, long-term common good.