Jim Telfer was facing eviction from his smallholdings at Damhead in Midlothian, which are earmarked for part of the Pentland Studios development.
But the Scottish Land Court has found in the family’s favour, ruling that they should not be removed from their 56 acres of land against their will.
The decision calls into question the entire Â£250 million film studio development, which was given final approval by the Scottish Government last December after a prolonged planning wrangle.
Afinal appeal to the Court of Session is already under consideration by the landowner who was hoping to sell the site earmarked for the studio, which was predicted to create 1600 new jobs.
Pentland Studios Limited, the developer which has spent more than four years pursuing the scheme, today said it was “respectful but disappointed” at the ruling.
Director Jim O’Donnell said the company was “currently considering options for the development.”
Environmental campaigners claimed the proposed development was totally unsuitable for the site and has led to the Telfer family being threatened with eviction.
The government’s own report on the Pentland Studios project said the studio would also cause “significant adverse effects on the character of the local landscape and on the visual amenity of those who live, work and travel nearby”.
However ministers said the project should be approved because its “potential for significant socio-economic benefits on a local and national scale through job creation and economic development.”
Last year the Telfer family insisted they had no intention of leaving the farm, despite being made a number of offers by Nick Gibsone, a landowner who has a provisional agreement in place with Pentland Studios Limited.
Mr Gibsone said his own family had been left "devastated" by the legal ruling.
He said: “We are disappointed not only for ourselves, and the developers, but for Midlothian and Scotland with the loss of hundreds of potential jobs and the boost to the economy the film studio could deliver. "
The Scottish Green Party, which has supported the Telfer family, said it was now “incumbent” on the Scottish film industry and the government to come up with an alternative site for a national film studio “where development would be lawful.”
The written decision from the Scottish Land Court states: “This estate does not need a film studio nor is there a community on the estate which would benefit from one.
“On the contrary, for it to go ahead, the only residents on the estate will have to leave. Moreover the estate itself is to be broken up as a direct result of this development. The estate as presently constituted will simply not exist if this project goes ahead. It will have lost more than half its area.
“In the present case the fact that one can hardly speak of a community when there is only one family living on the estate does not mean that that family’s interests are to be overlooked.
“On the contrary, the effect on them has to be taken into account when the court asks whether the resumption is for a reasonable purpose having relation to the good of the estate.
“That effect would be to dispossess them of all of their land, including their home and means of livelihood, and, although they would be compensated financially for that to the full extent required by law, it remains a negative effect since they would be leaving against their will.
“We recognise that deciding the case in such a way that a project said to be of national importance does not go ahead is a serious matter. However this is not the only place in Scotland on which such a development can take place.
“The considerable amount of work and expense which has been invested in it thus far shows that this is a serious and credible proposal. However it has come up against statutory protections on which the respondent is entitled to rely and which have compelled us to refuse the application.”
Green MSP Alison Johnstone said: “We welcome this decision from the Scottish Land Court.
“It is clear that the landlord has no lawful grounds to resume Jim Telfer’s tenancy.
“Quite why the landlord, the developers and some voices within the Scottish film industry ignored the fact that a sitting tenant has legal rights that have now been upheld is for them to explain.
“We have been consistent in our support for our constituent throughout this process and hope that the stress and anxiety facing Jim and his family is now over.
“It is now incumbent on industry and the Scottish Government to deliver the much needed national film studio on a site where development would be lawful.”
Mr Gibson added: "We are not by any means a wealthy family and the current estate is little more than 100 acres. We have spent five years trying to make the best of what we own and leave a lasting legacy that would be of benefit to the many, not the few.
We had hoped to reach an amicable agreement with the smallholding tenant within the provisions of smallholding law, which would have resulted in substantial compensation and this remains the case.
"This would also enable the developers to facilitate a project of national importance and make much-needed improvements to local land, in particular restoration of a site where thousands of tonnes of waste material had been left by a previous tenant.
"The Scottish Land Court’s decision is complex and took some time to be produced. We must now consider all options, including appealing the Land Court’s decision to the Court of Session."