A project to restore an endangered section of the British countryside – the Celtic rainforest in rural Wales – has been launched with funding from the Welsh government and the EU.

Almost £9m is to be spent trying to protect and improve the wet and temperate forests typically dominated by sessile oak, downy birch, ash and hazel, in an areacriss-crossed by tumbling streams and waterfalls.

Over the centuries the Celtic rainforest has deteriorated due to issues ranging from the planting of conifers, the invasion of species such as Rhododendron ponticum to grazing by sheep and deer.

The decline has put stress on precious flora, especially lichens such as Pyrenula hibernica (blackberries and custard) and tree lungwort, birds including the pied flycatcher, redstart and wood warbler, and mammals including the lesser horseshoe bat, otter and dormouse.

A group of organisations including the Snowdonia National Park Authority will invest the money in an attempt to rid four areas of Celtic rainforest of invasive species and find ways of improving their management, for example by changing how the woods are grazed.

Another key aim will be to generate interest and draw more visitors to the forests, which are the remnants of vast woodlands that once extended from northern Scotland to Portugal and are the atmospheric settings for legends and folk tales.

Emyr Williams, the chief executive of the Snowdonia National Park Authority, said the forests were some of the most valuable landscapes in terms of both wildlife and culture. “Thanks to this funding we can restore and safeguard our woodlands, and nurture amongst the people of Snowdonia and mid and south Wales an appreciation and pride in them so that they are safeguarded for future generations,” he said.

The Welsh environment minister, Hannah Blythyn, said: “Woodlands are a valued natural asset to us here in Wales. They’re vital to our environment, protecting against flooding, improving our air quality and providing shelter for livestock. The project aims to improve the condition of key woodlands in Wales significantly, helping us meet our European and international obligations for biodiversity and deliver important social and economic benefits for local communities.”

Katie-Jo Luxton, the director of RSPB Cymru, said: “Our beautiful, biodiverse and bewitching oak woodlands are some of the least known treasures of rural Wales. These natural forests feature strongly in Welsh folklore but have become undervalued and degraded in recent times. This project will help us restore these mysterious and special places, and encourage the people to celebrate and enjoy these places – and hopefully inspire a new generation of Welsh folklore writers.”

Four pieces of the Celtic rainforest in north and mid-Wales will be the focus of the project. They include Coed Felinrhyd and Llennyrch in Snowdonia, north Wales. Coed Felinrhyd was mentioned in the collection of Welsh legends, the Mabinogion, as the last resting place of King Pryderi of Dyfed, killed in combat with Gwydion the trickster.

The UK’s relationship with the EU after Brexit should not affect the project’s funding. The partnership has received assurance by the Welsh and UK governments that funding for the project will continue.