Image copyright PA Image caption Mr Mackay and Mr Harvie announced on Wednesday morning that a deal had been reached

The Scottish budget has passed its first parliamentary hurdle after winning the support of the Greens.

Finance Secretary Derek Mackay had been in negotiations with opposition leaders to find backing for the plans he first outlined in December.

A deal was reached on Wednesday after the Greens won an additional £170m for local councils.

And public sector pay rises will now apply to 75% of workers rather than the 51% that was originally proposed.

The revised budget proposals were approved by 69 votes to 56 in the Scottish Parliament, and now move onto the next stage in the legislative process ahead of a final vote next month.

The Scottish Conservatives and Scottish Labour voted against, but two Liberal Democrat MSPs backed the proposals.

The agreement means all public sector employees earning up to £36,500 will now receive a minimum 3% pay increase - which Mr Mackay said would cover 80% of NHS staff and the majority of teachers.

An anomaly in Mr Mackay's draft budget proposals from December that would have seen those earning between £43,525 and £58,500 paying less tax rather than more will also be addressed.

Mr Mackay said this would be done by changing the higher rate threshold to £43,438 rather than the £44,274 that had originally been proposed - a move he said would raise an additional £55m in taxation.

But it means the nearly 400,00 people in Scotland who fall into the higher rate bracket will have to pay more tax than under the original proposals.

The increased council funding includes an additional £10.5m to help fund inter-island ferries in Orkney and Shetland.

The minority SNP government had needed to win the support of at least one other party in the Scottish Parliament to pass its budget.

Mr Mackay outlined details of the agreement in the Scottish Parliament after the Greens confirmed a deal had been reached earlier on Wednesday.

Scottish Green co-convener Patrick Harvie said the extra council funding "more than reverses all of the £157m of local government cuts proposed by the SNP" in its draft budget.

Image copyright PA Image caption Mr Mackay had needed to win the support of at least one other party for his budget proposals

He added: "Last year we stopped the cuts; this year we've pushed the government even further and delivered a real-terms increase in funding, including a fair contribution towards the additional pressures councils are facing.

"While other parties continue to posture from the sidelines, Greens are making Scotland fairer."

Talks had also been held with the Lib Dems, who were seeking more support for education and health along with financial backing for ferry services in Orkney and Shetland, but an agreement could not be reached.

However, additional funding for the ferries will be included in the budget regardless - which was enough to win the backing of Lib Dem MSPs Liam McArthur and Tavish Scott, who represent Orkney and Shetland respectively.

Image caption The finance secretary said his budget means "people in Scotland will benefit from the best deal for taxpayers in the whole of the UK"

Analysis by BBC Scotland political editor Brian Taylor

There was a discernible pattern to events during the Budget debate at Holyrood this afternoon. Indeed, a mischievous Murdo Fraser suggested that the entire affair, the deal with ministers and the Greens, had been choreographed.

It was, to be frank, all fairly predictable. But only because the Greens made their demands quite explicit - and Derek Mackay, the finance secretary, left room for just such a deal in his draft proposals.

For example, there was an "anomaly" whereby those earning around £50k actually benefited from the draft budget, because of the increase in thresholds.

It was an anomaly inviting action. And so today it was duly removed, raising an extra £55m.

Read more from Brian here

Talks went down to the wire, with Green co-convener Patrick Harvie revealing he had stayed in contact via wi-fi even while taking part in a finance committee session about Brexit on Wednesday morning.

The Greens also backed last year's budget after securing a package worth a total of £220m in extra spending, including £160m for local authorities.

Mr Mackay said his proposals for the forthcoming financial year would "reverse Tory cuts, deliver support for the economy and increase health spending by £400m".

New tax bands

And he said the budget would provide "stability, sustainability and stimulus" for the economy and services.

Mr Mackay's draft budget, which was published in December, outlined plans for a new tax band of 21p for those earning more than £24,000.

The higher rate of tax would be increased from 40p to 41p and the top rate from 45p to 46p, while a starter rate of 19p in the pound would also be introduced.

Mr Mackay said the income tax proposals meant about 55% of taxpayers in Scotland would pay less than they would elsewhere in the UK.

What have the other opposition parties had to say?

Scottish Conservative finance spokesman Murdo Fraser accused the Greens of "falling sweetly into line", and caricatured the party as a "wholly owned subsidiary" of the SNP which was "taking orders from head office".

He also claimed the budget could be summed up as: "Pay more, get less".

His Scottish Labour counterpart, James Kelly, said the budget "falls well short of what is required."

Mr Kelly added: "The grubby deal that has been announced today by Derek Mackay, the Green-SNP deal, just doesn't cut it. Scotland's communities have been sold short by the SNP and Greens today."

And Liberal Democrat leader Willie Rennie said the budget did not provide the "transformational change" that Scotland needs.