A group of Whitby residents claim that for years millions of pounds has been "siphoned off" into general funds when it should have been ring-fenced for the use of the harbour.
For the past six years the council's annual accounts haven't been signed off because of objections from the group, called Fight 4 Whitby, over how it classifies income and expenditure from harbour land, including its car parks.
Earlier this year the council's external auditors Mazars ruled that only a court can make a determination on the extent of harbour land.
At a full council meeting the council's legal director Lisa Dixon said the focus was "now on bringing the long outstanding matter to a conclusion speedily" with the ruling made ahead of the new unitary authority coming into effect in April 2023.
Councillors voted in favour, with two abstentions, to seek a ruling in the courts. They also agreed that the council would not seek costs against the unnamed objector.
Coun David Chance, the last person to sign off the authority's accounts in 2015 when he was chairman of the audit committee, said he was "really pleased that sense has prevailed".
He told The Yorkshire Post: "It makes a hell of a lot of difference to the people of Whitby - they probably think Scarborough has been ripping them off for years.
"We had a situation where we had to renew the harbour piers. It took years to raise the money. If this had been accounted for properly the money to do the pier may well have been sitting in the harbour accounts."
The move came after the council failed to comply with Mazars' recommendation that it go to court by September 26. It will now apply to the court by December 31.
A council report earlier this year warned that up to £4.36m may have to be directed back into the harbour.
However Fight4Whitby, which first objected in 2016, citing the 1905 Whitby Urban District Council Act, says it could be millions more.
They believe as well as four car parks on the upper harbour, other property has also been built on harbour land.
John Freeman, former Mayor of Whitby and a member of Fight 4 Whitby, said: "I'm delighted that the officers of Scarborough Council have at last been forced into doing what they should have done many years ago.
"I think it will be a tremendous relief to the town that this long saga is at last coming to an end and Whitby will get money that has been siphoned off from its harbour.
"What should happen in future is that the money will be ringfenced for the benefit of Whitby Harbour, for maintenance, repairs and ongoing projects."
The group believe "probably another £20 million" is needed for repairs to the piers and the extensions by 2030.
They estimate that the amount of money which should have been ringfenced for the harbour is in the order of £1m to £1.25m a year minimum from 2015 to 2016 onwards. But a judge could decide to go further back in time.
Coun Chance said the council could cover the money from reserves, but a decision in favour of Fight 4 Whitby could cause "a revenue financial issue" going forward as the council wouldn't be able to count on the money from the car parks.
For centuries Whitby Harbour has been the town's commercial and visual heart.
John Freeman, who has been painting scenes around the harbour for 50 years, said their campaign, which has cost £35,000 so far, kicked off when Scarborough Council wouldn't let the town council take over the tourist information centre on Dock End.
Whitby Town Council wanted it as a community asset, but Scarborough Council decided to rent it out as a restaurant.
"Because of that residents started to look into the way the harbour run and it made them realise what Scarborough had been doing," he said.
"We have spent £35,000 fighting this by donations and loans which shows how important it has been to the townspeople of Whitby."