With 800 million voters and nearly 2,000 political parties taking part, India's elections are a staggeringly challenging exercise. And at the heart of the credibility of these complex elections is the robustness and integrity of the vote count.
For decades voting was blighted by the capture of polling stations and stuffing of ballot boxes by mobs hired by political parties.
All this changed with the introduction of the electronic voting machines at the turn of the century. However, from time to time, doubts have been raised about the machines. Parties, usually on the losing side, have often cavalierly alleged that the machines can be hacked into and ballots rigged.
With national elections looming in the summer, such doubts have emerged again. Last week, India's election authorities rejected claims by a US-based technologist who said the machines were hacked during the 2014 general elections in which Narendra Modi's right-wing BJP party swept to power.
But credible concerns about the technology used in the machines have persisted. There have been at least seven challenges in the courts but India's election authorities have steadfastly defended the machines as tamper-proof.
Each of India's 1.6 million voting machines record a maximum of 2,000 votes (the number of registered voters at any given polling booth does not exceed 1,500) and 64 candidates.
The locally-made machines run on batteries and can be used in areas without electricity. The software was designed by a group of engineers at a state-run electronics firm, and authorities insist that the machines and their records are not accessible to anyone outside this group.
Voters cast their ballots by pressing a button on the machine. Another button allows poll officials to stop the machine from recording more votes - this is used at the end of polling or if anybody tries to forcibly enter a polling station with the intention of casting fraudulent votes.
To prevent anyone tampering with the unit that holds the voting information, it is sealed with old-fashioned wax, supplemented by a secure strip from the election commission and a serial number.
The voting machines have so far been used in three federal and 113 state elections.
They save time: results from machines in a single parliamentary seat are available within three to five hours, down from 40 hours when ballots were counted manually. The machines have also eliminated "invalid" votes and led to huge cost savings.
Research has shown that the voting machines have significantly reduced electoral fraud and human error and been generally beneficial for India's democracy.
Using data from state elections, researchers Sisir Debnath, Mudit Kapoor and Shamika Ravi studied the impact of the voting machines in a 2017 research paper.
They found that the machines had significantly reduced electoral fraud, helped the poor and the weak to come out and vote, and made elections more competitive. They also found e-voting had led to a decline in the vote shares of incumbent parties.
India's election authorities have steadfastly maintained that the voting machines cannot be tampered with, and physical tampering is easily detectable. From time to time, these claims have been contested.
Eight years ago, University of Michigan scientists connected a home-made device to a machine and were able to change results by sending text messages from a mobile phone. Indian authorities rubbished the claim, saying that even getting hold of machines to tamper with would very difficult.
Experts like Dhiraj Sinha of the Massachusetts Institute of Technology (MIT) believe that hacking tens of thousands of voting machines on a mass scale would require lots of money, involve both those who make the machines and authorities - in this case India's election commission - and require the use of a very small receiver circuit with an efficient antenna "which would remain invisible to the human eye".
To enable wireless hacking, he says, the machine would need to have a radio receiver containing an electronic circuit and an antenna. Authorities claim the Indian machines do not have such a circuit element. In short, carrying out a mass hack would be next to impossible.
Some 33 countries use some form of electronic voting. The integrity of the machines has been questioned in some of them.
Machines used in the 2017 elections in Venezuela allegedly inflated the actual turnout by at least a million votes, a claim rejected by the government.
Argentina's politicians rejected plans for e-voting in the same year, raising concerns over ballot secrecy and manipulation of results.
A partial recount of votes was carried out in parliamentary elections in Iraq in 2018, following reports of technical glitches in electronic machines.
Last December, e-voting machines became a source of contention in presidential elections in the Democratic Republic of Congo amid reports they had not been thoroughly tested.
In the US, where voting machines were introduced some 15 years ago - there is now about 35,000 of them in use - there have been concerns over machines with no back-up paper trail misreading the vote.
Machines used to tally results and programme voting machines were found be to be carrying software allowing remote access to system administrators.
"My general opinion is that we should get as much technology out of the process as possible," Duncan Buell, a professor of computer science at the University of South Carolina who has been studying e-voting systems, told me.
"Software is very hard to get right, and with an intent to have votes not be identified with voters, there is no good way to verify that things have worked as intended."
However things may be moving in the right direction in India in efforts to make elections more transparent and trustworthy.
Five years ago, the Supreme Court ruled that all machines should be equipped with printers producing voter-verifiable paper audit trails.
When a vote is cast, a paper slip is printed containing the serial number, name and symbol of the candidate and remains exposed through a transparent window for seven seconds. After this, this slip automatically gets cut and falls into a sealed drop box.
Authorities have decided to tally the paper trail slips and compare them with the electronic result provided by the machine in at least 5% of booths in assembly seats. And since a full manual paper trail tally could be prohibitively expensive and time consuming, researchers have offered risk-limiting audits which could provide "high confidence in Indian election results."
For the moment, former election chief SY Quraishi believes the paper trail should put to rest all doubts in the minds of voters and political parties.
Since 2015, all state polls have been held using paper trails. In these elections paper slips generated by some 1,500 machines were counted and tallied with the votes in the voting machines. "There was not one mismatch," he said.