Image copyright Jaggery/Geograph Image caption Campaigners argued that Cymer Afan Comprehensive School was in the "heart" of the Upper Afan Valley

A law aimed at protecting future generations in Wales is "virtually useless", a senior barrister has said.

An attempt to use the Future Generations Act for the first time to challenge a school closure was unsuccessful.

Rhodri Williams QC said the judge's decision showed the law was "toothless".

The Welsh Government said the interpretation of the law was a matter for the courts.

But the judge's decision has cast doubt on whether the act could be used by opponents of the M4 relief road.

The Well-being of Future Generations Act, which came into force three years ago, says all public organisations must carry out "sustainable development".

It lists several "well-being goals" for public bodies, including "attractive, viable, safe and well-connected communities".

Lawyers acting for parents unhappy at Neath Port Talbot's decision to close Cymer Afan Comprehensive tried to use the act as a means of getting the decision reviewed, because of the potential impact on the community of losing its school.

But the case was dismissed in March by High Court judge Mrs Justice Lambert, who said the act could not trigger a judicial review.

She said: "I do not find it arguable that the 2015 act does more than prescribe a high-level target duty which is deliberately vague, general and aspirational and which applies to a class rather than individuals.

"As such, judicial review is not the appropriate means of enforcing such duties."

The judge also said the closure of Cymer Afan was "not inconsistent" with Neath Port Talbot council's published "well-being objectives", so was compliant with the act anyway.

Image caption Opponents had been looking to the Future Generations Act in their fight against the M4 relief road

Mr Williams QC, the barrister acting for the campaigners, told BBC Wales Live he had always felt the act was a "particularly badly-drafted piece of legislation".

"Everyone wants to see a resilient Wales, a prosperous Wales, a Wales in which there isn't any inequality," he said.

"But the point is unless individuals can rely on these rights - if they feel they haven't been upheld - to challenge the decisions of public bodies, the act is virtually useless.

"The guidance that has been issued on it is full of fantastic-sounding phrases but in reality individuals are not going to be able to use it.

"So if public bodies for whatever reason can't take into account and apply their obligations, there will be no redress, which effectively means the legislation is toothless."

Opponents of an M4 relief road have suggested the act could be used as a way of triggering a judicial review if the Welsh Government decides to go ahead with the road.

A decision on whether ministers will build the £1.4bn route around Newport is expected to be announced in early June,

Mr Williams said the outcome in the Cymer Afan case casts doubt on whether that would be possible.

"This is only a first instance decision but it is a decision of the High Court that there is no right for an individual or a group of individuals to bring a claim for judicial review based on an allegation of a breach of the act," he added.

Plaid Cymru AM Llyr Gruffydd said the development was "immensely disappointing" and suggested the law may need to be amended.

Andrew RT Davies for the Welsh Conservatives said the "reality" of the law "has fallen well short of the rhetoric".

Image caption Sophie Howe, as future generations commissioner, monitors whether public bodies are complying with the act

The future generations commissioner, Sophie Howe, whose job it is to monitor whether public bodies are complying with the act, said: "I have monitored very carefully the developments around the first judicial case using the Well-being of Future Generations Act as a ground for judicial review.

"I also took legal advice on these issues and the points of law involved.

"Given the fact that the case was at a very initial stage which would not set precedent and given my limited resources, while I might not agree with all of the arguments or conclusions, I have decided not to intervene in this specific case.

"I will continue to monitor legal developments around the act very carefully and do not exclude intervening formally in the future depending on the specific circumstances."

A Welsh Government spokeswoman said: "The Well-being of Future Generations Act requires that public sector bodies consider the long-term implication of any decisions they make.

"This includes assessing the long-term impacts of more controversial and difficult decisions, such as whether a school should be closed."

Neath Port Talbot council added: "The council was always confident that it had complied with its statutory obligations in this case, having undertaken the most comprehensive and rigorous consultation process prior to the final decision being taken.

"So it proved in court."

Wales Live is on BBC One Wales at 22:30 BST on Wednesday.