Sixty years ago, an American dude named Richard Musgrave wondered how efficient market mechanisms are. He found that there are some areas where the market performs terribly badly, such as education and social redistribution (investments are recouped after a time that is not worthwhile for a market that calculates present value) and disaster preparedness (from flood protection to defence).
The market performs poorly in this area because
(1) a company calculates only up to its own limits and does not take into account the spill-over of the damage to the economy as a whole, which then trickles down to itself
(2) the market is there to find the equilibrium point on the supply-demand curve -- but market processes are slow, and there are "uncorrectable events" on the negative side of the market swings. For example, if something causes food production to fall, prices rise in the market, making it more profitable for farmers to produce more food, equilibrium is restored -- only correction takes time, and half the population may starve in the meantime. Or we start talking about financing the building of arms factories when there is already a war on, the arsenals are empty and the enemy is knocking at the door.
So in critical areas the state must either act directly (education, social safety net) or as a regulator. Otherwise, there will be a slap in the face or a knife in the stomach.