The move has been welcomed by environmentalists who said carving a 14-mile, six-lane stretch of motorway around the city of Newport would wreck a precious and historic landscape.
But it has angered many business leaders and some opposition politicians who believed the M4 relief road was needed to ease congestion on the main route into south Wales.
The project would have been the most expensive infrastructure project the Welsh government had embarked on. A year-long public inquiry examined the pros and cons and ruled in favour.
But the Welsh first minister, Mark Drakeford, announced on Tuesday he was shelving the project on the grounds of cost and its environmental impact.
He said: I recognise the inspectors conclusions. However, I attach greater weight than the inspector did to the adverse impacts that the project would have on the environment.
In particular, I attach very significant weight to the fact that the project would have a substantial adverse impact on the Gwent Levels SSSIs [sites of special scientific interest] and their reen [drainage ditch] network and wildlife, and on other species, and a permanent adverse impact on the historic landscape of the Gwent Levels.
He said: This decision is being made at the point of maximum uncertainty about our financial future. Unprecedented austerity in the public finances is combined with a complete lack of clarity over our capital budgets for the coming years, and is exacerbated by the uncertainty surrounding Brexit. He said a commission would look at alternative solutions to the traffic problems around Newport.
The Gwent Wildlife Trust was among the fiercest opponents of the scheme, fearing it would devastate the levels, home to otters, water voles and wading birds.
The Romans first drained the area to create a breadbasket for their army before a push into the Welsh mountains. The network of drainage ditches are home to fauna and flora including the rare king diving beetle, as well as the nationally scarce rootless duckweed (wolffia arrhiza), the smallest vascular plant on Earth. The trust compares the richness of the biodiversity of the area to that of the Amazon rainforest.
Its chief executive, Ian Rappel, said: We are delighted for both people and wildlife that the UKs most ecologically damaging motorway scheme has been scrapped for good and we congratulate the first minister on his decision.
At a time when international studies have revealed that the world is on the brink of the sixth mass extinction – where 40% of our insects are declining and after a climate emergency was declared in Wales – Welsh government should be congratulated for the bold decisions they are making for the future health of people and wildlife.
It is the third time since devolution that Welsh ministers have shelved the project. Welsh Labours manifesto for the 2016 assembly elections, under the leadership of the former first minister Carwyn Jones, said the party would deliver an M4 relief road.
The Conservative party criticised the decision, with the shadow minister for business, economy and infrastructure in the assembly, Russell George, claiming the announcement was a kick in the teeth for Welsh commuters and business people.
After years of procrastination and dithering from successive Welsh Labour governments, £44m spent on a public inquiry, and numerous pleas of help from business leaders, weve got nowhere, he said.
Its shameful that the first minister has poured millions of pounds down the drain in completing the inquiry, yet only to ignore its findings.
Congestion on this road is a foot on the windpipe of the south Wales economy, and is damaging our businesses and their future prospects. Im now urging the first minister to end the uncertainty and quickly give us an alternative to how he intends to alleviate congestion on the M4.
RSPB Cymru welcomed the move, saying: The array of wildlife shows what a special place the Gwent Levels is and it is also a very special place for the communities that live there whose wellbeing is restored by this precious green space that exists so close to Cardiff and Newport.
It picked out the shrill carder bee as one of the species that would be protected thanks to the decision. The Gwent Levels population is one of its two remaining strongholds in the whole of the UK, the charity said, adding that the crane had also recently returned to breed on the levels after an absence of more than 400 years.
The director of Friends of the Earth Cymru, Haf Elgar, said: This is a great news for Wales and the planet. This decision is testament to the untiring efforts of local residents who have opposed this plan over decades.
Darren Shirley, chief executive of Campaign for Better Transport, said: This signifies the end of business as usual for new road building.
At a time when we urgently need to tackle air pollution and greenhouse gas emissions we cant afford for this decision to be a brave one-off.
But Stephen Crabb, MP for Preseli Pembrokeshire, said the Welsh government had bottled it, adding: We may as well put a sign at the Severn Bridge saying: Wales closed to new business.
In a letter signed by the First Minister, he said he did not see a ''compelling case in the public interest'' for the scheme.
The proposal was for a second motorway to the south of Newport, parallel to the existing M4 motorway from junction 23A at Magor, to junction 29 at Castleton, avoiding the need to widen the Brynglas Tunnels.
But the First Minister took concerns over the environmental impact of the scheme into consideration and its impact on the nearby Gwent Levels.
I attach greater weight than the Inspector did to the adverse impacts that the Project would have on the environment. In particular, I attach very significant weight to the fact that the Project would have a substantial adverse impact on the Gwent Levels
Reacting to the news, the director of the Confederation of British Industry described it as a ''dark day for the Welsh economy.''
This is a dark day for the Welsh economy. After decades of deliberation and over £40m spent, no problem has been solved today. Congestion and road pollution around Newport can only increase. Economic growth will be stifled, confidence in the region will weaken and the cost of an eventual relief road will rise
Todays announcement is a short-term measure that regrettably solves nothing and sends the message that Wales is not open for business.
As the Welsh Government said at the public inquiry, the black route would emit less carbon emissions than the current road and the whole project would be carbon neutral by 2070. The wider south Wales region around Cardiff and Newport constitute only 4% of Welsh carbon emissions in total. That figure will now likely rise at a higher rate than if the black route had been built.
While we struggle to see what alternative could be better than the M4 black route, the ball is back in the Welsh Governments court to deliver their Plan B. An urgent and credible solution to the problem of congestion around the Brynglas tunnels must now be developed.
Plaid Cymru, who were against the plans, welcomed the news stating that it would have been ''environmentally damaging'', but criticised the Welsh Government for the cost in delaying the decision.
The inquiry and the consultations have cost in excess of £44m. Mark Drakefords indecision has cost us years better spent planning for alternative and sustainable improvements to the roads in Newport and south-east, significant investment to strengthen public transport to get people off the road and out of their cars, and in developing green infrastructure investment projects for Wales.
This is an appalling way for a government to make key decisions. Time and again, we see only disorganised governance from a tired Labour party who arent fit to be in charge and make decisions affecting Wales.
This is the second example of a U-turn in a week. The black route was the Labour Welsh Governments flagship policy and appears in both Mark Drakefords leadership manifesto and 2016 Welsh Labour manifesto. It was also his decision to write to the UK Government as Finance Minister asking for borrowing powers which would be used for the black route.
Funding originally allocated to the black route must now be re-directed to green and sustainable alternatives – as should have always been the case.
Wales needs real leadership. Plaid Cymru would create of a Wales-wide sustainable green transport package which would offer modern and innovative solutions to Wales infrastructure and travel problems.