Cash-strapped Edinburgh councillors will spend £5 million investigating whether they should complete the capital's troubled tram line - but said they will pull the plug if Lothian Buses cannot pick up the final bill.

Councillors voted to "give some oxygen" to the "floundering" bid to resurrect the original line to Newhaven and rejected Conservative pleas for a city-wide referendum on the plan.

SNP group leader Sandy Howat said a referendum would "simply divide the city".

Labour group leader Andrew Burns said the £5 million would prepare the ground for a final decision in mid-2017.

But if Lothian Buses cannot provide cash for the next stage "then that is the end of it", he said.

The council asked for a £20 million "extraordinary dividend" from its majority shareholding in Lothian Buses, but bosses refused to commit the cash until they had factored it into their capital plan to be published in September 2016.

Edinburgh Council is nearly £1.5 billion in debt with a budget deficit of £141 million and rising, but the executive believes a tram line to Newhaven will yield a net economic benefit.

The final cost of the existing line to York Place, two-thirds of the original route, is expected to be nearly £1 billion including loan interest - making it one of the most expensive public sector projects in Scotland.

Mr Burns said: "If the board comes back and says the extraordinary dividend request would have some sort of catastrophic shock on the economic viability of Lothian Buses then that is the end of it.

"I hope that is clear enough, because we are not going to do anything that would create an economic shock that would have negative consequences on Lothian Buses.

"If the board does come back and indicates that it can cope with that, then that will feed into the decision for 2017 and form part of stage two going forward - or not."

The SNP group reluctantly backed the £5 million exploratory works.

Mr Howat said: "This agreement is not agreeing to extend the tram - it is agreeing to investigate extending the tram.

"Whilst the tram is not dead it is certainly floundering along and we need to give it some oxygen, and get a debate in there to see what it is actually all about.

"The Conservatives are calling for a referendum next May (but) it's simply going to divide the city.

"If you have a referendum are we going to have to say that the whole city has to vote Yes for it?

"Or are we going to say that only the people of Newhaven and Granton have to vote Yes?

"What if the good people of Morningside that I represent say No because it doesn't impact them directly?"

He added: "This party was very clear in its opposition to the tram in the past.

"Councillor Cardownie (former SNP group leader) even called for a referendum back then.

"Had we all listened at that point we might not have wasted £776 million, over-done the business case and ended up with a two-thirds built tram line.

"We weren't convinced then, we're not convinced today, but we are pragmatic and we live in the real world.

"The tram is magnificent and it is here, but we need to look at it in the round."

Conservative transport spokesman on the council Nick Cook said: "The people should now decide. This is yet another fudge from an administration that is addicted to the stuff."