Speaking at the prestigious Oxford Farming Conference, Mr Lochhead also called for changes to the farm and rural funding system but insisted reform should take place from within Europe.
Mr Lochhead said: “Westminster’s in-out referendum on the EU is a £20 billion gamble with the future of Scottish and British farming.
“The CAP is a protective shield for UK agriculture. Leaving the EU would mean leaving the CAP. It would be folly to think the UK Government would fund farming at anywhere near existing levels from domestic budgets and so the EU referendum is the biggest risk to agriculture in this country.
“The stakes are high, especially for Scottish farmers and crofters for whom CAP support is a vital lifeline. It is more difficult to make a living from the land in Scotland – of which 85 per cent is classified Less Favoured Area – and we have a predominance of livestock sectors which often face the biggest challenges in terms of profitably."
Mr Lochhead also called for the CAP to be simplified and to focus on sustainable food production, economic growth and ensuring farmers of the future are available to put food on our tables and capitalise on demand for Scottish produce around the world.
He said:“We must have change - but reform must come from within Europe. The CAP must be simpler and more streamlined with food production at its core.
“Changing the budget allocations in future must be a priority. While Scotland is struggling to make ends meet with the lowest per hectare payment rates in Europe, other Member States have been given so much rural development funding they don’t know what to do with it. The needs to be addressed at EU and UK level.
“And I am convinced that money needed to administer the complex new CAP could better spent on more worthwhile things like new entrants.
“I look forward to working with the EU’s new Agriculture Commissioner on his simplification agenda, and I have already asked for a mid-term health check of this CAP. That review of the implementation detail is important. But what we also need is an overhaul of the way the whole CAP system works, in line with Brian Pack's recommendations – and this must be done from within the EU.”