A few days ago, Waleed Aly asked a not-so-rhetorical question in The Sydney Morning Herald. He wondered how many Australians were worried about the fact that the Australian Federal Police had spent a good portion of this week raiding the offices and homes of journalists who’ve published stories clearly in the public interest.

His conclusion? Not many. He went on to argue that it is because we have developed a culture of accepting excessive state power, with no real thought about the consequences for civil liberties or the functioning of our democracy.

Sadly, I would have to agree with Aly, but as with so many surveys, the answer you get depends on the question you ask.

What if we asked, “Hands up who feels comfortable with relying on the Facebook posts and Twitter feeds of our politicians and departmental spokespeople for information about what our government is up to? Who thinks that is a good way to run a democracy?” Then, I bet you’d get a very different answer.

Read more: Why the raids on Australian media present a clear threat to democracy

I agree that Australian media are hardly trusted by the public, but I am also convinced that most Australians recognise the need for some kind of independent watchdog keeping track of politicians and the government on our behalf. It might be imperfect and messy, but a free press has performed that role well enough to keep us broadly on track for much of our history.

Earlier this week, my colleague and fellow University of Queensland researcher Rebecca Ananian-Welsh laid out the intricate web of national security laws passed in recent years that collectively serve to straight-jacket journalists and threaten legitimate whistle-blowing.

In a number of research projects, we have been looking at both these laws and their impact on reporting, and while we still have a long way to go, the early results suggest something deeply troubling.

While they may have helped shore up national security, the laws have also led to a net loss of transparency and accountability. It has become harder for journalists to reach and protect sources and keep track of wrong-doing by government officials. It has also become harder for them to safely publish in the public interest without risking long years in prison or cripplingly expensive and traumatic court cases.

Read more: Five reasons terror laws wreck media freedom and democracy

An overhaul of Australia’s legal landscape

My organisation, the Alliance for Journalists Freedom, has published a white paper that offers a better way of balancing those two crucial elements of our democracy - national security and press freedom.

The most important of its seven recommendations is a Media Freedom Act. Australia has no legal or constitutional protection for press freedom. It isn’t even formally recognised in law; the High Court has merely inferred that we have a right to “political communication.”

That needs to change. The AJF is proposing a law that would write press freedom into the DNA of our legal system. It would both prevent our legislators from unnecessarily restricting journalists from doing their jobs and give judges a benchmark they can use whenever they are adjudicating cases that deal with media freedom issues.

That alone isn’t enough though. The second recommendation in the white paper calls for changes to the national security laws themselves.

Currently, many of the current laws that Ananian-Welsh laid out in her article include a “public interest” defence for journalists. But as we have seen in this week’s raids, that does nothing to stop the AFP from trawling through journalists’ documents for sources and forcing everyone into court.

Read more: Media raids raise questions about AFP's power and weak protection for journalists and whistleblowers

Instead, there should be an exemption for journalists and their sources when reporting on matters of public interest.

That isn’t to suggest that journalists should be immune, though. Rather, the onus should be shifted to the authorities to show why the public interest defence should not apply. It is also important that the exemption include whistleblowers.

Beyond national security, there are a host of other laws that have contributed to a wide culture of secrecy at odds with the principles of open government.

Payouts under defamation laws now routinely run to millions, potentially destroying news organisations and chilling further investigative work. Shield laws that allow journalists to protect their sources in court are also inconsistent across states and need to be strengthened.

Suppression orders that judges use to smother reporting of certain court cases are being applied with alarming frequency and urgently need review. And whistleblower legislation needs to be strengthened to encourage and protect anybody speaking out about wrongdoing in government or elsewhere.

While the raids of the past week have been shocking, they have forced us all to think again about the role of the media in a democracy. If it leads to better legislation that both protects national security and media freedom, then some good might have come out of it after all.