The SNP has reached an agreement with the Scottish Greens to pass its Budget at Holyrood.

Finance secretary Derek Mackay said the Scottish Government struck a deal with the six Green MSPs which involved greater tax-raising powers for councils.

The details were finalised at the eleventh hour, shortly before Mackay entered the chamber to begin the stage one debate on his 2019-20 tax and spending plans.

The finance secretary told MSPs the deal includes new powers for local authorities to introduce a tourist tax on hotel stays.

He also said council tax rates increases would be capped in real terms at 3% for the coming year - which equates to a maximum increase of 4.79%.

He added that cross-party talks would be launched with a view to replacing the tax altogether.

Mackay further announced additional funding to the local funding core grant of £90m, which he said would not impact on cash ring-fenced for the NHS.

Ministers will also back changes to legislation currently going through Holyrood that could allow local authorities to bring in a levy on workplace parking - although hospitals and other NHS properties would be exempt.

Council funding settlements will in future be made on a three-year basis, with this taking place from 2020-21 onwards.

Mackay said: "The Scottish Budget proposes an additional £2bn of investment.

"It provides an increase of almost £730m for health and care services, more than £180m to raise attainment in our schools, and gives a vital boost to our economy through a £5bn infrastructure programme.

"As a result of these decisions, we have been able to invest in essential public services, particularly the NHS, while ensuring 55% of income taxpayers in Scotland pay less tax than those earning the same income in the rest of the UK.

"The Scottish Government has continued to ensure our partners in local government receive a fair funding settlement despite further cuts to the Scottish budget from the UK Government.

"These additional measures will deliver the most significant empowerment of local authorities since devolution and provide additional funding to support local services."

He continued: "This enhanced package offers up to £187m of increased funding and flexibility to councils, on top of the £11.1bn local government settlement.

"In total, overall spending power for local authorities next year will be £620m higher than it is currently."

The finance secretary added: "With these changes I hope this Budget will receive the support of parliament."

As a minority government, the SNP administration at Holyrood requires the support of other parties to pass its legislation, including the annual Budget.

It is the third year running the finance secretary has turned to the Scottish Greens to get his tax and spending plans through parliament.

Commenting on the agreement, Scottish Greens' co-convener Patrick Harvie said: "The public rely on local services such as schools and social care, and local facilities such as sports centres and libraries.

"Today's Green budget deal means councils can protect these services and the jobs of front line workers.

"It's welcome that after consistent Green pressure the SNP Government have seen sense and committed to immediate action and longer-term reform.

"Scottish Greens will always be firm but constructive in these situations."

Speaking in the chamber, Harvie added: "Scotland has a centralised, constrained and under-powered system of local government and that needs to change.

"The package of local tax reform measures we've seen announced today will make real progress.

"We have for the first time a clear, definitive timescale for publishing legislation to abolish and replace council tax during this session of parliament."

He condemned the other parties for failing to take part in the Budget process, after both the Conservatives and the Liberal Democrats demanded the SNP ditch any prospect of a second independence referendum before May 2021 as their key condition.

The Green MSP said: "Others seem to think that engineering a crisis would be the best outcome instead of achieving changes that work for the country.

"It's as though some people look at the US government shutdown or the shambolic incompetence at Westminster and think they should do the same here.

"Chaos for the sake of chaos is not what Scotland needs."

Scottish Conservative finance spokesman Murdo Fraser said his party had offered to talk to the SNP but claimed ministers would "rather talk to the anti-growth, anti-business Greens".

The Tory MSP highlighted that Mackay's income tax plans mean a growing tax gap between some Scottish and UK taxpayers, after Chancellor Philip Hammond raised the 20p rate threshold to £50,000 in his own Budget.

The Scottish Budget, if passed, will keep the 41p higher rate threshold frozen at £43,430.

Fraser said: "Instead of reducing the tax burden, they're going to put it up.

"And the consequence will be the Scottish economy will continue to under-perform and will have yet more taxes for hard working families. That is not a direction that we can support."

He added that the potential rise in council tax and introduction of tourist taxes, coupled with the income tax changes, amounted to "triple tax bombshell which will do nothing for the competitiveness of the Scottish economy".

Scottish Labour's James Kelly also made his party's opposition to the plans clear.

He told MSPs: "Labour will never sign up to a Budget that's got cuts to local council services in it.

"This is an unfair budget based on unfair taxation when it awards tax cuts up to everyone earning £124,000.

"So if you're a chief executive or a managing director or a cabinet secretary, then you're cheering this Budget on tonight because it's going to give you a tax cut.

"But if you're a commuter on a platform waiting for a delayed or cancelled train, not able to get to your work or a hospital appointment, you won't be cheering this Budget on."

Scottish Liberal Democrat leader Willie Rennie criticised the Greens, who he said had once again "ridden to the rescue of the SNP".

He said: "The Greens have been bought cheaply, the extra money for councils was already available.

"Local government finance reform has been delayed until the next parliament, bogged down, once again, in another commission.

"Patrick Harvie has settled for the vice-convenership of the car parking working group."