In the “trolley problem”, we imagine a terrible choice. A runaway train is bearing down on people lying on the tracks. If we do nothing, many will die. If we derail the train, there will be fewer deaths, but it will cause chaos.

In a Covid-19 world, this thought experiment is being played out in real life, on a global scale. The train is the virus and we’re the ones lying on the tracks, peering helplessly at our political leaders. If our leaders pull the lever one way, untold numbers of people will die before their time. If they pull the other way, many will be saved but the world economy will be brought to its knees.

Liberal democracies, including Australia, have made a profound and humane choice: to preserve as many lives as possible. Or at least to try.

Now governments must answer an even harder question: how to implement this decision, while preventing economic collapse and staying true to our liberal democratic values?

For their loved ones, every individual who dies from Covid-19 is a tragedy. As the death toll continues to rise, especially in Europe and North America, the pressure on our communities, and our governments, is immense. Meanwhile, people are losing their jobs. There is also real suffering behind closed doors for many elderly people, people with disability, victims of domestic violence and people experiencing homelessness.

Even the luckiest among us are adjusting to restrictions on our freedom. We are working from home, getting used to home schooling our kids, and living in isolation from people we love and who make our days brighter.

Australia now has strict rules about when we can and can’t go out, what we can do and who we can meet with. There’s strong community support for these restrictions. We can see how they keep us safe.

Our community has come together, making big and small sacrifices for the greater good. But there can be a dark side. Our willingness to accept sacrifice leaves us vulnerable to the insidious threat of creeping authoritarianism.

Each restriction must be reasonable, necessary and proportionate to the threat

Some countries are spying on their citizens to enforce quarantine laws, or even welding some residents in their homes to stop the spread of the virus. Other countries have suspended the usual democratic protections, and are ruling by decree.

There are growing calls for more extreme measures in Australia. For example, new technology can enable surveillance at an unprecedented scale, using everything from CCTV to our mobile phone data. Artificial intelligence can be used to automate the enforcement process for anyone breaching the rules.

But the Australian Human Rights Commission’s work on human rights and technology highlights that, when such technologies are used in policing, they can unfairly disadvantage people based on attributes like their race or gender. Moreover, as we saw with robodebt, automated enforcement can be prone to error.

International law allows many of our freedoms to be restricted in response to a public health emergency. But each restriction must be reasonable, necessary and proportionate to the threat. And emergency restrictions must be temporary, with genuine independent oversight.

These provisos are crucial. In the middle of the second world war, when Britain looked like it might be succumb to Nazi Germany, the country’s highest court considered a law that allowed large numbers of foreigners with “hostile associations” to be locked up. Famously, Lord Atkin pushed back, declaring: “Amid the clash of arms, the laws are not silent.”

So, too, in a pandemic. We can accept targeted restrictions on our ability to move freely, but we should resist extreme calls for our rights to be curtailed. No liberal democracy should tolerate, for example, a blanket prohibition on people seeking food or medical care, as such measures cause innocent people to suffer needlessly.

We need to combat Covid-19 strongly and effectively, but also consistently with our values of fairness, equality and justice. This means pushing back on authoritarian restrictions that could ultimately do more harm than good.

We must also speak up for those whose voices are hardest to hear. To take just one example, as human rights commissioner, I inspect Australia’s immigration detention facilities. Many of the people in these facilities are seeking asylum from authoritarian conditions in their own countries. Detainees typically share small rooms with strangers, making social distancing almost impossible.

Many of the same experts who have been central to Australia’s response to Covid-19 have recognised the high risk of the virus spreading in often-crowded places of detention. Last month, the Australasian Society for Infectious Diseases recommended that immigration detainees who do not pose a significant security or health risk should be released into housing in the community.

Our government should heed this advice to reduce the risk of an outbreak of Covid-19 running rampant in a detention facility and from there spreading to the wider Australian community.

If combating Covid-19 is a war, we can be proud of why we got into the fight: to preserve life, especially for vulnerable people. Those are the best of our values.

We must now ensure those same values guide how we fight. At times, this won’t be easy. But our unbreakable commitment to human rights will make our sacrifices more bearable, and will be vital as we rebuild after the war is won.

• Edward Santow is Australia’s human rights commissioner. Join him at 1pm on Wednesday for an Australia at Home discussion on “Human Rights and AI in the Time of Covid 19”