Malcolm Turnbull visited Trangie this week, a small town in regional New South Wales, just west of Dubbo. There, the prime minister announced a drought assistance package for farmers – up to $12,000 for couples – and consoled a charity worker who confronted him in front of news cameras about the dire situation locals face. As of this week, 100 per cent of NSW is in drought.

Trangie, which relies on the Murray–Darling Basin for water, was particularly hard hit by Australia’s last severe drought in the early 2000s. It was this devastating dry spell, the worst on record, that prompted calls for a management plan of the basin and the water it holds.

When officials were tasked with designing the national plan to manage the flows of the Murray–Darling Basin, they were supposed to use the best available science to calculate how much water would need to be diverted from irrigators’ allowances to support the environment.

But according to one who was involved, the method used to determine how many thousand billion litres should be recovered was far from scientific. They joked about basing the first four digits of the figure on a random NSW postcode.

Speaking to the Murray–Darling Basin Royal Commission, former Murray–Darling Basin Authority official David Bell said this was because there was a “very clear understanding” coming from the board and management that whatever the figure was, it had to begin “with a number two”.

The legal definition says that the level of take – and therefore the diversion limit – must be based on environmental considerations.

The Adelaide-based royal commission, which opened in June, is examining the design and management of the basin plan over the past eight years. Headed by constitutional lawyer Bret Walker, SC, it is investigating whether decision-makers within successive Labor and Coalition governments nationally – and some officials who served them – may have broken the law, both in how they designed the plan and how it has been managed ever since.

Counsel assisting, Richard Beasley, SC, has indicated in his remarks to the commission that the evidence before it suggests it is a possibility.

“The basin plan is a $13 billion plan,” Beasley told the commission in his opening remarks on June 18.

“It’s important that those funds are not just spent usefully, but also lawfully and in accordance with the objects of the Water Act and the basin plan as properly construed.”

Beasley issued a warning to those who make and implement the law.

“Parliament can always repeal, replace or amend legislation it doesn’t like, subject to constitutional powers,” he said.

“But there is no place in a country governed by the rule of law and the separation of powers to have the executive or a government statutory authority say, ‘Well, we don’t like the law, so we are going to do our own thing.’ Decision-makers don’t get to lawfully make decisions simply by deciding that words in a statute mean what they say they mean and nothing more. Whatever else that is, it’s not statutory construction and it’s not acting in accordance with the rule of law.”

Appearing on that first day, David Bell described how staff at the authority responded to their managers’ direction to make sure the volume of recovered water began with a “two”.

“Somebody quipped: ‘Well, perhaps it should be Tony Windsor’s postcode,’ ” Bell said of the 2011 process.

Windsor, then an independent federal MP, was chairing a parliamentary inquiry into the Murray–Darling Basin at the time.

Bell believed the system needed billions of litres of water more than Windsor’s Tamworth postcode of 2340 would provide and joked they should opt for the Queensland town of St George instead, then the hometown of the Nationals’ Barnaby Joyce.

“My sort of contra-joke, as it were, was, ‘I wish it were Senator Joyce’s postcode’ – as he then was,” Bell told the commission. “Because at that time, he was resident in western Queensland and so it would have started with a four.”

Seven years on, with the 23 river valleys and one million square kilometres of the Murray–Darling river system still in a parlous state and a crippling drought adding extra sting to that black humour, the royal commission established by the former South Australian Labor government – which its Liberal successor has continued – is trying to find out exactly how we got here.

Bell was among the first in what has become a procession of former officials and respected scientists to regale the royal commission with alarming observations on the standard of administrative practice and the lack of a scientific and possibly legal basis for how the river system is managed.

Another witness, Dr Matthew Colloff, who formerly worked for the Commonwealth Scientific and Industrial Research Organisation, described “interference” from the Murray–Darling Basin Authority and “attempts to influence CSIRO findings” related to modelling ahead of setting the water-use limits.

“I felt our scientific integrity was being compromised and independence undermined,” Colloff said.

The royal commission has summonsed four current senior authority officials and another now working for New South Wales, but the federal government has refused to allow them to appear. It has also blocked the commission’s access to documents and has mounted a High Court challenge to its legal authority.

The court is due to hold a two-day hearing in October.

If its right to compel witnesses and evidence is upheld, the commission may summon other officials after that.

The evidence of the witnesses who have already appeared is dramatic.

It suggests an endemic disregard for proper process in the management of water in the Murray–Darling Basin – previously and now – that, if confirmed, is scandalous.

What the commission has established so far is that the science was referenced initially.

A 2010 preliminary guide to the then-proposed basin plan used hydrology modelling to identify how much water should be recovered from irrigators and other consumers and returned to the environment.

Scientific experts recommended a range within which a “sustainable diversion limit” should be set. They based their work on the Water Act’s requirement that the limit must reflect an “environmentally sustainable level of take”.

In the Act, that level is defined as the amount of water that can be used for consumption, including for irrigation and industry, without compromising key environmental assets and outcomes, ecosystems or the productive base of the water resources themselves.

The legal definition says that the level of take – and therefore the diversion limit – must be based on environmental considerations.

While the Act stipulates that economic and social impacts should be considered in managing the basin plan overall, it does not allow them to form part of those calculations at the start.

In other words, the black-letter law says the environment is to be considered first.

The expert work presented in the guide – and peer reviewed following scientific protocols – suggested that the amount of water to be recovered from irrigators should be somewhere between 3856 gigalitres and 6983 gigalitres a year.

But it warned that the lower amount had a “high degree of uncertainty” of achieving the desired environmental outcomes.

That meant 3900 gigalitres was the bare minimum that should be recovered for the environment. Even then, that was unlikely to be enough to do the job.

But between the publication of the guide and the finalising of the plan, something changed. Suddenly, it had to begin “with a two”.

When the basin plan was produced, the amount of water the authority said had to be recovered was significantly lower – at just 2750 gigalitres a year.

Since then, state and regional side deals have reduced it even further.

Counsel assisting the commission, Richard Beasley, said the level being recovered at present, officially, is 2100 gigalitres, although evidence casts further doubt on that figure.

Scientists have said they believe theft, double-counting, and shonky metering and monitoring of water use means it could actually be half that amount or less.

So, what prompted the authority’s dramatic downward adjustment?

When the guide and its data first came out, some farmers and irrigators were enraged at what they saw as an excessive demand being considered.

On October 13, 2010, a group of furious agriculturalists piled copies of the guide on the ground outside the Murray–Darling Basin Authority office in Griffith, NSW, and set them alight.

To the authority staff’s grim amusement, the glossy guide wouldn’t burn easily – according to David Bell, it apparently had “some sort of finish on it which made it a bit fire retardant”.

The fact the farmers’ protest wasn’t literally very inflammatory couldn’t mask the officials’ shock at the public outcry over their work.

But the politicians took note.

Less than two weeks later, on October 25, 2010, then water minister in the Gillard government Tony Burke told parliament he was taking long-overdue action to restore the Murray–Darling system and prioritise “strong communities and food production” alongside healthy rivers.

“These priorities do not need to be in competition with each other,” Burke said.

He insisted things had improved, with more water flowing into the Macquarie Marshes through good rain and water buybacks.

“Downstream, the mouth of the Murray is flowing naturally for the first time since 2002 and locals talk about how you can see the light in people’s eyes again because there is water in the Lower Lakes,” he said.

“I am concerned that, unchecked, the current basin plan implementation will lead to a worse environmental outcome than would have arisen if there were no basin plan.”

But the minister acknowledged the basin guide’s release two weeks earlier had prompted “a wave of strong reaction across the country”. While some had locked in behind it, others feared it would “devastate their industry or town”, and some who had argued for an independent basin authority had “returned without blinking to the interstate rivalries of old”.

There were also those, he said, who questioned the political consensus that had forged the Water Act, which governed the plan’s formation.

The history of managing the Murray–Darling Basin – home to two million people – is fraught. It winds its way through four states – Queensland, NSW, Victoria and SA – plus the ACT, but politicking over water extends beyond those boundaries and predates federation.

The architects of Australia’s Constitution anticipated both the need for water conservation and agriculture’s ongoing role. But they also foresaw trouble, devoting section 100 entirely to water.

“The Commonwealth shall not, by any law or regulation of trade or commerce, abridge the right of a State or of the residents therein to the reasonable use of the waters of rivers for conservation or irrigation,” the section says.

To the frustration of many who’ve sought to manage conflicts since, however, they did not propose a way to resolve interstate brawling or define what is “reasonable use”.

In October 2010, Tony Burke’s words suggested he feared the much-lauded federal-state consensus was about to collapse.

About this time, the Murray–Darling Basin Authority began to increasingly emphasise economic and social considerations, alongside the environment, in drafting the basin plan.

Burke said the guide did “not represent government policy”.

“It does not even represent recommendations to government from the MDBA,” he added.

He said the authority would begin examining “the socioeconomic impacts” of the water limits before drafting the plan.

Despite the range recommended in its own guide, the authority had already indicated elsewhere in the document that it had examined scenarios below the recommended minimum, involving 3000, 3500 and 4000 gigalitres.

It said cutting water entitlements any more than that “would not meet the requirements for the Water Act because they would not represent an optimisation of economic social and environmental outcomes”.

Reflecting on that adoption of a triple-bottom-line approach instead of prioritising the environment, counsel assisting, Richard Beasley, said: “Now, at that point the Basin Authority has probably already fallen into legal error.”

In setting how much water had to be kept back from irrigators, the authority and the government chose – and have chosen since – to weigh up the social and economic impact alongside the Water Act’s environmental obligations.

This interpretation allowed the scientific assessments to be set aside and reduced the volume to be recovered.

Tony Burke’s 2010 speech to parliament signalled that shift.

Burke also took the extremely unusual step of tabling official legal advice prepared for him that day by the office of the Australian government solicitor.

He cited this advice in defence of the move to consider the social and economic impacts when setting water limits.

The 10-page document, which is now before the royal commission, includes what appears to be a somewhat circular argument outlining the broad objectives of the Water Act and the Murray–Darling Basin Plan and that socioeconomic concerns should be heeded in managing it.

But buried in the advice, prepared by then chief general counsel Robert Orr, QC, and senior counsel Helen Neville, are lines that appear to contradict the very point Burke said it supported.

The document notes the basin plan must ensure Australia is upholding its obligations under international environmental agreements and says while the Water Act’s objectives include maximising economic returns, this is “subject to ensuring returns to environmentally sustainable levels of extraction for water resources that are over-allocated and overused”.

“Economic objects can only be pursued to the extent that they are consistent with addressing over-allocation and overuse,” the advice clearly states.

It also appears to suggest a way of using the environmental provisions to meet social and economic objectives.

In order to establish how much water to save for the environment, the legislation required that “key” environmental assets needing protection – lakes and floodplains, for example – be identified.

The legal advice appears to suggest one option was for the authority and the minister to “not identify an environmental asset as key”.

Some 20,000 assets were considered subsequently and 2442 were determined to be key.

A CSIRO report, although critical of aspects of the process, said the choice of key assets was scientifically defensible.

In his parliamentary speech, Tony Burke quoted from a 2008 CSIRO report warning that climate change was likely to make the situation in the Murray–Darling Basin worse.

But when the plan was finalised, it appeared to ignore the impact of climate change in setting its water limits.

Evidence before the royal commission also suggests the views of Indigenous Australians on allocations for cultural practices may not have been adequately considered, as the legislation requires.

On December 7, 2010, six weeks after Burke’s speech, the chair of the Murray–Darling Basin Authority board, Michael Taylor, resigned.

Taylor’s resignation statement said factoring in potential social and economic impacts was “a significant challenge”.

He said the authority’s own legal advice confirmed “it cannot compromise the minimum level of water required to restore the system’s environment on social and economic grounds”.

Counsel assisting, Richard Beasley, commented that it was unclear whether the authority had decided to act against that legal advice or whether the advice had changed by the time the plan was drafted.

When Taylor left, former NSW state Labor minister Craig Knowles was appointed in his place.

Neither has appeared before the royal commission at this stage.

Former water bureaucrats and scientists have told the commission that the diversion limit adopted – of 2750 gigalitres – will not sustain the environment, let alone restore it as required.

It has not satisfied those concerned with economics either.

Former NSW water bureaucrat David Harriss told the commission that NSW had protested that even the 2750 gigalitre recovery target would have “serious economic consequences”.

Its proposals led to subsidies for irrigators and farmers to undertake infrastructure improvements – for example, better lining their water channels to stop leakage – as an alternative to directly taking back so much water.

But hydrologist Dr John Williams and resource economist Professor Quentin Grafton, both of the Australian National University, have told the commission the $1.7 billion in “efficiency measures” have robbed the environment further.

They argue that the leakage, although inefficient, was returning water to the ground. Stopping it meant this water was no longer going back to the environment and therefore the equivalent should be added to the amount being cut from irrigators’ allocations.

But that hasn’t happened, contributing to double-counting and the real amount returning to the river being substantially less than the official 2100 gigalitres, the total after the side-deal subtractions.

They and others say other supply measures have also undermined the river system’s natural flow, which includes filling floodplains and pushing water all the way downstream to the Murray mouth, actions essential for its ecology.

Williams and Grafton said they had been unable to obtain an explanation for how the 2750 gigalitre figure was arrived at. The calculations for sustainable limits were “baffling” and appeared “to defy scientific logic”.

Aside from the way its water-retention levels were set, there are questions about whether the Murray–Darling Basin Authority is achieving them, whether its endorsed water-saving methods actually work and whether its records are even accurate or being undermined by undocumented water theft.

David Bell is concerned about all of it.

He told the commission the way the plan is being implemented at all levels “is seriously undermining its effectiveness and the competent management of water resources.

“I am concerned that, unchecked, the current basin plan implementation will lead to [a] worse environmental outcome than would have arisen if there were no basin plan,” he said.

Others are equally fearful.

John Williams, a former member of the Wentworth group of scientists, which has long sounded the alarm about climate change and water, also raised serious concerns.

“I think the goals that are in the Act and supposed to be delivered by the plan in the current form cannot succeed,” Williams told the commission last month.

“Firstly, the amount of water is not scientifically defendable … There’s no adjustment for climate change … and accounting hasn’t been done properly, so we do not know what we have recovered and what we have taken from Peter to pay Paul. So there’s a whole string of issues that I could list that, in my mind, place this plan in great jeopardy of failure.”

The word emerging repeatedly in the commission’s evidence is “compromise”.

Richard Beasley said the authority had misinterpreted that word as it appeared in the Water Act.

It had chosen to read it as referring to a negotiated agreement – a balance between environmental, social and economic outcomes – but he said it was referring to compromise, as in endangerment, of the environment.

Even with the commission’s reporting deadline still six months off, there’s a clear message around compromise emerging from the evidence: if politicians and their officials are going to employ the practice of reaching one, they need to do it before legislation is drafted, not after.

Otherwise compromise can become compromising – putting them potentially on the wrong side of the law.