NEW YORK — Last Tuesday, millions of Americans stood in long lines to cast their votes. While they waited, sometimes for several hours, many used their smartphones to pass the time.

Some read articles about the election. Others updated their Twitter or Instagram feeds with pictures of the lines at the polls. And some took care of more private tasks, like sharing health information with their doctors, reading and editing confidential work documents, or paying bills and transferring money using banking applications.

Once in the voting booth, they slipped their phones into their pockets and purses and, in many cases, picked up a pen and a piece of paper to cast their ballot.

So at a time when we can see video shot by a robot on Mars, when there are cars that can drive themselves, and when we can deposit checks with our smartphones without going to a bank, why do most people still have to go to a polling place to vote?

That’s because, security experts say, letting people vote through their phones or computers could have disastrous consequences.

‘‘I think it’s a terrible idea,’’ said Barbara Simons, a former IBM researcher and coauthor of the book ‘‘Broken Ballots: Will Your Vote Count?’’

Simons ran through a list of calamitous events that could occur if we voted by Internet. Viruses could be used to take over voters’ phones; rogue countries like Iran could commandeer computers and change results without our knowledge; government insiders could write software that decides who wins; denial-of-service attacks could take down the Internet on Election Day.

‘’

‘‘It’s a national security issue,’’ Simons said. ‘‘We really don’t want our enemies to be able to determine our government for us — or even our friends, for that matter.’’

But other countries allow citizens to vote via the Internet, or are experimenting with the idea. In 2005, Estonia started testing an online voting system and has since registered more than a million voters who cast ballots online. Italy plans to test an online voting system this year.

Still Ronald L. Rivest, a computer scientist at the Massachusetts Institute of Technology, said that for now, the best technology is the one we have been using.

‘‘Winston Churchill had a famous saying that democracy is the worst form of government, except for all those other forms that have been tried before,’’ Rivest said. ‘‘You can apply the same statement to paper ballots, which are the worst form of voting, but better than all the others that have been tried before.’’

Rivest, who is the R in the name of the RSA encryption system, which is used by government institutions and banks, said that if things went wrong on Election Day, chaos could ensue, because doubts about the results would rattle the foundations of our democracy.

‘‘One of the main goals of the election is to produce credible evidence to the loser that he’s really lost,’’ he said. ‘‘When you have complicated technology, you really do have to worry about election fraud.’’

So what’s the solution? Simons and Rivest both seemed certain that the best alternative was to stick with a technology that is a couple of thousand years old. ‘‘Paper,’’ they both said. ‘‘Paper ballots.’’