A bank needs to have enough money on hand to cover any losses it might make if any of the groups or individuals it has lent money defaults on their loans. If it does not, it may find itself unable to cover what it owes to its depositors, and hence become insolvent.
Central banks do not allow commercial banks to decide for themselves how much to keep to cover the risk. Instead, they impose capital adequacy ratios (also known as solvency ratios) that set the amount of its own money a bank needs relative to its total loan portfolio.
The Basel Accord requires all banks to maintain primary capital equal to at least 8% of their assets (ie have a capital adequacy ratio of at least 8%). Individual central banks may require higher levels of capital adequacy in their own areas of jurisdiction.
Also, different kinds of banks will have different ratios. For instance, loans to small businesses tend to be defaulted more frequently than mortgages on residential property, so banks with a high level of exposure to the former may want to have a higher capital adequacy ratio, as would banks with, for example, a high exposure to derivatives.