When the button was pushed to decide the makeup of the New South Wales Legislative Council, the studiously impartial New South Wales Electoral Commission could have been excused a sigh of relief. Not because they would care who won, but because until that moment a truly disastrous outcome for the commission remained a live possibility.

The events that led to this situation should serve as warning signs that we are taking our election processes for granted, placing democracy under threat for the sake of a very small financial savings.

The problems in NSW relate to the use of its online voting system, iVote. Initially intended as a way to improve access to democracy for the vision impaired, iVote is now widely used by voters outside New South Wales on election day as a substitute for postal voting or attendance at a foreign embassy.

However, the above-the-line boxes for two parties were accidentally left off the Legislative Council iVoting ballot. This was fixed within two days, but in the meantime 19,000 people had voted. Online voting allows an opportunity for voters who missed the chance to vote for their preferred party above the line to go back and fix it, but if one of the affected parties had lost narrowly they would have had grounds to challenge the result. Depending on circumstances, the whole state might have been headed back to the polls for an upper house voting election.

Before the election, this looked rather unlikely, but as the count went on it became clear that one of the affected groups, the Animal Justice Party (AJP), was either going to win the last upper house spot or miss out narrowly. In the end the AJP won by 3177 votes (0.07% of the total), a margin that would probably have been a few hundred larger without the error.

This wasn’t the only controversy about iVote, however. As Antony Green demonstrates, the iVoting system appears to give a substantial advantage to parties in the first five columns on the Legislative Council ballot.

Even more seriously, two computer scientists claimed there was a security flaw that would have made it possible to tamper with iVote. The commission fixed the issue but claimed there was never any danger.  This is disputed by those who uncovered the flaw. Whoever is right on this, it is a concern that we effectively have to take the commission’s word that the system was not open to rigging.

All this should put to rest suggestions, such as those raised by Clive Palmer, that we should all be voting electronically. Electronic voting, particularly online voting, may create fewer problems than the use of paper ballots, but those we experience will affect hundreds of times as many votes.

Many people assume that if we can do our banking online it should be easy to vote securely as well. It’s not clear if this belief extended into the New South Wales Electoral Commission, leading to over-enthusiasm for expanding iVote. The view ignores the importance of confidentiality in voting. If someone hacks your bank account, you will notice the missing money and report it. The bank will then have a good idea whose account the money has gone into. However, if someone breaks into an online voting system to change 10% of the votes for one candidate to support their opponent, the secrecy of the ballot means there is a high chance no one will ever know, and a higher one still that no one would be able to prove it.

The commission seems to think it has addressed this problem with its voter verification system. However, this still requires the voter to take it on trust that the vote is processed as it has been stored. Moreover, it leaves open the possibility of the system being hacked so that it is possible to identify how someone voted, ending the secret ballot, which should be one of Australia’s proudest inventions.

A quick look overseas should make this clear. The Dutch government spent millions on electronic voting machines and an online system, only to abandon them when hackers demonstrated their capacity to easily tamper with either system. Just last week Slate revealed that the password to one make of electronic voting machine, widely used across Virginia, was “Admin”, and you didn’t even need to be in the polling booth to access it.

However, an even deeper problem is the underfunding of electoral commissions, a problem Australia-wide. It is difficult for the commissions to make a fuss about this, but recently the Tasmanian Electoral Commission went public with the extent to which funding cutbacks are making it hard to do its job.

Commissions are expected to operate so efficiently that things like checking for errors on the iVote become surplus to requirements. Similarly, training of polling-day staff has been in decline for many years, which makes the events in Western Australia unsurprising. Reports of undertrained staff delivering incorrect information are common.

It’s easy in such circumstances to blame individuals, particularly those in the line of command, wherever the election was close enough for the problems to show up. Often that may be justified, but the real problem is systemic, and it can only be fixed through a combination of more money and respect for electoral expertise, rather than employing managers who don’t understand the specific challenges elections produce.

The lesser risk is that if we don’t address these problems we will end up with more election reruns such as WA, costing far more than is saved by trimming a few hours off the training staff undergo.

The much bigger risk is Florida 2000, an election whose legitimacy half the country doubts, with very good reason.