The hope is that it could be rolled out across the North of Ireland, where 30 per cent of water pollution comes from farms.
John Doherty milks several hundred cows at Crosshead Farm near Claudy.
His land is at the top of a hill which slopes down to the banks of the River Faughan, an important protected habitat for otters and salmon.
The river also provides a substantial amount of Derry’s drinking water.
Working with the Woodland Trust and the Loughs Agency, Mr Doherty has redirected his land’s drainage system so that it flows into a newly-planted four-acre wood by the side of the river.
Two thousand native trees including alder, willow, birch and oak have been planted around a pond which has been dug out to hold 250,000 gallons of water.
This so-called “wet wood” serves a dual purpose.The pond acts as containment for any potential pollution spill, giving Mr Doherty time to react before it reaches the river.
The trees will also filter out nutrients and silt from farm run-off which might otherwise reach the Faughan.
Mr Doherty, a third generation farmer, said the Faughan was “part of his heritage”.
“It has been here for me and my father and his father and I want it to be here for the other generations and we do value where we are here so I think we have to do our bit,” he said.
He said the wet wood provided a “buffer” between his farm and the Faughan and putting it in had given him “peace of mind”.
A new forest expansion scheme means this kind of planting could be attractive to other farmers.
They can now plant trees on three or more hectares of their farm which will attract a payment.
Dave Scott of the Woodland Trust said as well as protecting the river, the wood would provide important habitat for wildlife and capture 4-600 tonnes of carbon over its lifetime.
Lionel Knobbs of the Loughs Agency, which is responsible for the Faughan, said other farmers were expressing an interest in similar schemes.
He said it was a low-cost option for farmers, because the trees were provided and volunteers helped plant them, something he described as “sweat equity”.
His main focus is to prevent silt from farmland being washed into the river where it can clog spawning beds for salmon and trout.
John Doherty said it had not been a difficult decision to put in the wet wood.
He said when the small cost was reckoned against potential fines and subsidy penalties from a pollution incident it was a “no brainer”.
And he said while he had planted four acres of his 300 acre farm, he believed it could work just as effectively on much smaller areas.