BRUSSELS (Reuters) - European Union leaders took a big stride towards establishing a single banking supervisor for the euro zone, agreeing it would enter into force next year, opening the way for the bloc's rescue fund to inject capital directly into ailing banks. European Council President Herman Van Rompuy said the 27 leaders agreed at a Brussels summit to adopt a legal framework by the end of this year giving the European Central Bank overall responsibility for banking supervision. "Once this is agreed, the single supervisory mechanism could probably be effectively operational in the course of 2013," he told a news conference after nearly 10 hours of talks. French and EU officials said all 6,000 banks in the single currency area would gradually come under ECB supervision by 2014, starting with banks receiving state aid, then large cross-border institutions. Most day-to-day oversight would be delegated to national bodies. Creating an effective banking union, for which this deal was a first step, is regarded by the International Monetary Fund and market economists as a key component in overcoming the euro zone's three-year-old debt crisis. French President Francois Hollande said the leaders did not discuss possible financial assistance for Spain, but he laid out a series of steps that could turn a corner in the crisis. "Tonight, I have the confirmation that the worst is behind us," he told a 3 a.m. news conference. We are on track to solve the problems that for too long have been paralyzing the euro zone and made it vulnerable. If the December European summit confirms the decisions we took, if Greece finds a lasting solution, if Spain recovers funding mechanisms, then we will be done with a situation which weighed on markets and on the confidence in the euro zone. German Chancellor Angela Merkel said it would take more than a couple of months before the supervisor was fully effective and direct bank recapitalization could be considered. However, the agreement appeared to be a defeat for German Finance Minister Wolfgang Schaeuble's efforts to delay and limit the scope of European banking supervision. A French government source said the European Stability Mechanism (ESM) could start recapitalizing troubled banks as early as the first quarter of 2013, but a German source said it was "very unlikely" to happen so soon. Merkel earlier demanded stronger authority for the executive European Commission to veto national budgets that breach EU rules. She said a December EU summit would take decisions on these issues of closer euro zone economic governance. The EU leaders issued a statement welcoming Greece's progress towards an agreement with its lenders and saying good progress had been made in putting the bailout back on track. On the banking union, much work remains to be done and the deeper the discussion union goes, the more complex and problematic it will get.