A public service culture of reward and punishment could have led senior officers to not speak out about the unlawful robodebt scheme, a royal commission has been told.
When problems with the scheme were revealed, former minister Stuart Robert wanted to "double down" rather than apologise and correct the error.
The commission is examining how the robodebt scheme operated for several years despite its illegality.
Renee Leon, a former human services department secretary who is now vice-chancellor of Charles Sturt University, appeared before the commission on Tuesday.
She became secretary in October 2017, two years into the scheme's operation.
Professor Leon said the briefing she received upon her appointment did not raise any issues with the scheme and was shocked when she received advice from the solicitor-general that the program was unlawful.
Because it was already established when she took the position, Prof Leon expected any problems had been properly examined before it was implemented.
In her experience, rigorous processes within the public service were designed to stop an unlawful scheme from going ahead.
This includes the secretary assuring the minister who in turn assures cabinet that policy risks have been considered and are lawful.
Prof Leon said Mr Robert told her "legal advice is just advice" when she presented the solicitor-general findings.
When robodebt was discovered to be unlawful, Prof Leon advised Mr Robert the department apologise to customers, admit the error and inform the public of steps to correct it.
She remembered Mr Robert replied: "We absolutely will not be doing that. We will double down."
Prof Leon said some ministers suggested ending the robodebt program while not repaying debts or telling anyone unless people appealed but she felt this was inconsistent with legal obligations.
Asked what could have led to the scheme continuing for so long, Prof Leon said it was possible senior officers asked themselves the wrong questions about its lawfulness.
But she also raised the possibility that people could have doubted the legality but were reluctant to withdraw such a popular proposal that had promised to raise billions of dollars.
"I hope that's not the case, because the public service ought to have some red lines and lawfulness is one of them," she said.
Prof Leon said, in her experience, former coalition ministers would stop speaking to secretaries and refuse to deal with them if they presented "unhelpful" advice, whereas officers "responsive" to their policy agenda would be "rewarded".
"It wasn't popular to give advice to the (former) government that what they were trying to do was wrong," she said.
Prof Leon said the rewards included promotions to high-profile government departmental roles.
The commission also heard the former coalition government was "very attached" to the robodebt program despite difficulties for departmental staff administering it.
"The measure was very unpopular and it was very difficult for both the customers and, frankly, for the staff of the department to administer it," Prof Leon said.
"It was difficult for people to find their pay slips from years ago. It was hard to defend it as a good idea.
"But it was the government's policy, so the things we were trying to fix were about trying to make the service delivery experience not so difficult within the limits of the policy."
Prof Leon believed her determination to provide "frank and fearless" advice to former coalition government ministers contributed to her employment being terminated in 2019.
Lifeline 13 11 14
beyondblue 1300 22 4636