Farmers angry that prime agricultural land is being "sacrificed" to mining have been told by NSW Premier Nathan Rees the latter industry is economically more important.
More than 200 farmers rallied outside NSW Parliament on Thursday before the upper house debated Greens leader Lee Rhiannon's private member's bill aimed at protecting farms, rivers and water catchments from mining operations.
Under the Mining Amendment Bill, any new mining would be banned in areas defined as prime agricultural land, and within a kilometre of rivers and water catchments used by those farms.
The NSW Farmers' Association, which organised the rally, supported the Greens' bill.
With the support of the two Shooters Party MPs and Fred Nile, the government ensured the bill was defeated by one vote after the coalition sided with the Greens.
However, Ms Rhiannon vowed the "fight is certainly not over and the campaign would continue".
When asked about reaching a compromise between the mining sector and farmers, Mr Rees said there were far more jobs in coal mines.
"It is always a balance. If you look at other similar type equations, out at Orange for example in the central west where you have the Arcadia mine out there, a very successful mine, but requiring a lot of water," he told reporters before the vote took place.
"Well, ultimately mines generate many, many more jobs than agricultural production."
Earlier, farmers and their supporters had crowded along Macquarie Street holding signs declaring "You can't eat coal" and "Shame Macdonald shame", aimed at Primary Industries Minister Ian Macdonald.
Gloucester Resident Partnership president Gary Ferris was cheered when he addressed the crowd saying "we are a community being ignored by the state government."
"Gloucester is sick and tired of being lied to by Ian Macdonald. Of being disregarded," he said.
Gloucester produces a range of foods including beef, milk, cheese, poultry, wine, vegetables and fruit.
Mr Ferris said mining farmland would threaten Australia's "food bowl".
"Long term destruction of our valuable agricultural and food producing land has to be stopped," he said.
"Where will the food come from once our land is destroyed?"
The NSW Minerals Council criticised the bill, saying it was unnecessary and a Greens' ploy to play the farming and mining industries off against each other.
Council chief executive Dr Nikki Williams said the bill would strip mining industry jobs and hurt the economy.
"This bill is irresponsible," she said in a statement.
She said the cost to the people of NSW in terms of employment, royalties and export earnings were also a mystery.