The family had put everything they could back into the farm.

When they were being made homeless the Environment Secretary personally intervened.

More than 13,000 people have signed an online petition in recent days calling for politicians to step in to prevent Andrew Stoddart being evicted from land he has farmed in East Lothian for more than 20 years.

Despite investing over £500,000 in the land, Mr Stoddart, his wife Claire an their four young children will be evicted by the end of the month after the landowner dissolved their agreement.

The Scottish Government said it had been attempting to facilitate mediation between landlords and tenants for some time, but that the environment secretary, Richard Lochhead, had now stepped in a bid to find a solution.

A spokeswoman said: "Given the urgency of this situation the Cabinet Secretary personally intervened recently when he spoke to Mr Stoddart and subsequently asked Government officials to consider urgently whether there are any practical steps we can take to help Mr Stoddart over the next few weeks, before his tenancy is due to come to an end on November 28.

"As part of this consideration, and in response to the recent representations from stakeholders, the Government hosted a discussion on Monday with a range of interested parties, including STFA, to discuss ways to assist Mr Stoddart and we are exploring these with urgency."

It comes as the SNP faces growing pressure to adopt a more radical approach on land reform including offering tenant farmers a right to buy land. At its conference last month, SNP members refused to endorse the Scottish Government's Bill, which is currently making its way through Holyrood.

The online petition, which calls on Nicola Sturgeon to take action, states: "The Stoddart family are an integral part of the community. Andrew and Claire are well liked, and their three children go to the local school, as do the four children of their employees."

The farmer, who has grown crops and reared sheep on the land since taking up the tenancy in 1993, says he and his family will have to move away from the area and start life afresh.

Mr Stoddart believes the decision not to renew his tenancy agreement is a result of the dispute.

He said: “Obviously they want a new tenant who they can charge more rent to; had I known the risk I was taking at the time I would never have requested a rent review.”

Mr Stoddart estimates his investments in the farm, which include erecting a 25,000 square foot grain shed equipped with a 40-ton-per-hour grain handling system, are well over £500,000, but says he is not being offered adequate compensation for leaving it behind, it was reported.

He said: “I am 52 now, I am not as young as I was when I first came here.

"The work I have put into turning this land into a working farm when it was little more than a building site, I couldn’t do that now.

“It is my life and my livelihood which is being taken away, not just from me but from my family and employees.

“It is devastating how little legal rights we have after so many years investing in this business.” The decision not to renew the lease came after Mr Stoddart and the Colstoun Trust, which owns the land, became involved in a 10-year wrangle over rent.

Mr Stoddart says he began paying rent in 1993 for the land which included Colstoun Mains Farmhouse but was never allowed to move into the main house.

Andrew and Claire Stoddart have been farming in East Lothian for 22 years.