An application for an offshore windfarm within view of Donald Trump's Aberdeenshire golf resort was mishandled by Government officials, his legal team has claimed.

Gordon Steele QC suggested, at the Court of Session in Edinburgh, that if the windfarm project was not a "guinea pig" then it was "one of the first applications" handled by Marine Scotland, the Scottish Government directorate which manages the country's waters.

Mr Trump opposes the 11-turbine European Offshore Wind Deployment Centre (EOWDC), claiming it will spoil the view from his nearby golf course.

The US property tycoon is challenging the legality of the Scottish Government's decision to approve the windfarm.

In his closing comments to the court, Mr Steele said the windfarm proposal was one of the first considered by Marine Scotland.

"In my submission, this perhaps helps to explain what I say are the procedural irregularities and, frankly, mishandling of this matter by Marine Scotland," he said.

"We were, if not the guinea pig, one of the very first applications before them."

Mr Trump has said he will pull the plug on his own controversial plans to finish his proposed luxury resort, with a large hotel, holiday homes and residential village, if the windfarm goes ahead.

Mr Steele argued that the benefits flowing from the two proposals should have been compared. He said he previously underestimated the number of jobs to be created by the Trump development when he put it at between 4,000 and 5,000.

"In the resort construction, there will be of the order of 6,000 jobs created and 2,000 in the resort operation," he said.

"The vision of Mr Trump is to construct the greatest golf course anywhere in the world, capable of hosting a major championship.

"We are at the absolute extreme end, or perhaps off the spectrum, in relation to considerations of this type."

Mr Steele also referred to a blog on a golf website where First Minister Alex Salmond is quoted as saying the windfarm will "absolutely" be built.

The statement, as reported, "does not sit happily" with ministerial guidelines, he said.

The petition, lodged by Trump International Golf Links and the Trump Organisation earlier this year, asks the court to declare that the Scottish Government's decision to approve the windfarm on March 26 was unlawful.

It also challenges the decision not to hold a public inquiry into the project in Aberdeen Bay.

Mr Steele referred to Mr Trump in his closing remarks to Lord Doherty, stating: "It's beyond doubt that this inward investor does not feel that he has been treated fairly, reasonably or in an unbiased fashion.

"Accordingly, I invite my lord, in the interests of the Trump Organisation but much, much more importantly in the national interest, to uphold the petition for judicial review."

James Mure QC, closing the Scottish Government's case, said potential benefits to golf or tourism have to be weighed with benefits in other areas.

"The responsibility for weighing and balancing the different policy considerations rightly rests in our system with the Scottish ministers. The job is not that of an accountant," he said.

The First Minister sought advice from senior civil servants on public statements regarding the windfarm development and took the matter "very seriously", Mr Mure said.

The comment reported on the blog was only part of an overheard conversation, he said.

"The context of what was overheard is by no means clear."