Image caption German Finance Minister Wolfgang Schaeuble: "The talks were lengthy, quite difficult and intense"

European Union (EU) finance ministers have agreed an outline plan on how to rescue troubled banks - without leaving taxpayers to face the bill.

The banks' creditors and shareholders will take the first hits, followed by savers with deposits of more than 100,000 euros (£85,000).

If that is not enough, government help will be called upon and taxpayers will be among the last to shoulder losses.

EU taxpayers have had to pay for a series of bank rescues in recent years.

Dutch Finance Minister Jeroen Dijsselbloem said the outline deal marked a big change in the way that troubled banks are bailed out.

"If a bank gets in trouble we will now, throughout Europe, have one set of rules on who pays the bill," he said.

"The financial sector itself will now to a very, very large extent become responsible for dealing with its own problems."

The next step is for EU governments to negotiate over the legislation with the European parliament.

'The new rule'

The global financial crisis coupled with the sovereign debt crisis in the eurozone has hit the region's banking sector severely.

Countries from across the EU - such as Cyprus, Spain and Ireland - have pumped tens of billions of euros in to try and prop up their ailing banks over the past few years.

This establishes 'bail-ins' as the new rule Michael Noonan, Finance Minister, Ireland

In each case, the national government had to foot the bill for rescuing its banks, leading to market fears that the losses at the banks may be more than the government could absorb.

The problem was compounded by the fact that most eurozone governments rely on their own banks to lend them the money they need.

However, things changed earlier this year after Cyprus was asked to raise money through a levy on all Cypriot bank deposits - including those below 100,000 euros - as a condition for securing a loan package worth 10bn euros (£8.4bn; $13bn) from its EU partners and the International Monetary Fund.

But that proposal caused panic in financial markets and was quickly withdrawn.

On Thursday Ireland's Finance Minister Michael Noonan, who chaired the latest talks, said that the new plan aimed to establish clarity on who paid to rescue ailing banks.

"Our aim is to have a common approach throughout Europe so our taxpayers no longer have to shoulder the burden," he said.

"This establishes 'bail-ins' as the new rule," he added, referring to a term used to describe losses being shouldered by a bank and its stakeholders instead of "bailouts" which use public funds.

Earlier this month, ministers agreed guidelines on how the eurozone's emergency bailout fund can inject money directly into struggling banks.

The fund will be able to inject a total of 60bn euros into troubled lenders but the bank's national government, and its lenders and depositors, will still have to share the burden of any rescue.