While washing your hands is the best way to defend against the spread of infectious diseases, a new study from Michigan State University finds that when it comes to hand washing in restrooms, most of us do a poor job.

Of the 3,749 people researchers observed in public restrooms in bars, restaurants and other public establishments, most people didn't wash their hands long enough to kill germs. One third didn't use soap and 10 percent just opted out of hand washing altogether. To gather their data, student researchers tried to go undetected, standing off to the side and entering results on a smartphone.

Separated by gender, findings showed that 15 percent of men didn't wash their hands at all, compared with seven percent of women. When men did wash their hands, only half of them used soap, compared to nearly 80 percent of women. Men in particular were found to be more likely to wash their hands if a sign encouraging them to do so was present in the restroom. Another factor that encouraged hand washing: a clean sink.

"These findings were surprising to us because past research suggested that proper hand washing is occurring at a much higher rate," said lead researcher Carl Borchgrevink.

The US Centers for Disease Control and Prevention, whose guidelines the researchers followed, reports that it takes 15 to 20 seconds of vigorous hand washing with soap and water to effectively kill germs. Yet, findings from the study showed that most people wash their hands for about six seconds.

The study, announced this week, was published in the Journal of Environmental Health.