EU nations agreed new rules for bank bailouts or "bail-ins" late Wednesday, to save taxpayers from paying for the rescue of ailing financial institutions, an official said. "Big step tonight," EU Commissioner Michel Barnier wrote on Twitter. "Taxpayers no longer in front line to pay 4 banks mistakes," he added. "Banks will have to put money aside for rainy days. We are learning lessons of crisis," he said after the agreement was reached by representatives of the European Parliament, the European Council -- the EU's executive arm -- and the 28 member states. The aim is to make European banks stronger so that they "can lend to the real economy," he added. The new directive will eventually dovetail with the EU's "Banking Union", which is currently being hammered out. All countries now accept the principle that if banks get into difficulty, then it will not be the taxpayer but investors and creditors that bear the costs. But differences remain as to how to put that into practice. EU ministerial talks in Brussels on Tuesday focused on a so-called Single Resolution Mechanism (SRM) that would step in to close a bank at risk before it could do too much damage to the wider economy. The SRM would have a pot of cash at its disposal -- funded eventually by the banks themselves -- to cover the cost involved so the taxpayer does not have to pick up the bill. The SRM would follow an already agreed Single Supervisory Mechanism that the European Central Bank will run to oversee the top 130 or so eurozone banks directly, and thousands more indirectly via national authorities. While all agree in principle, the political issues are fraught since the new system would effectively hand control of national banks to the EU. Those talks will resume at ministerial level next week with hopes for agreement by the end of the month.