A Michigan man has been charged under anti-hacking legislation designed to protect trade secrets after logging on to his wife's email account and discovering she was having an affair.

Leon Walker, 33, faces a trial lawyers say could have significant repercussions given that nearly half of US divorce cases involve some form of snooping, such as reading emails, text messages or social networking.

Walker was charged after opening the Gmail account of his wife, Clara, who was married twice previously. Walker found she was having an affair with her second husband, who had once been arrested for beating her in front of her young son from her first husband.

Walker handed the emails over to the boy's father, saying he was concerned for the child's safety. The father sought custody.

"I was doing what I had to do," Walker told the Detroit Free Press. "We're talking about putting a child in danger."

When Clara Walker discovered the emails had been read and passed on she went to the authorities.

The Walkers were divorced earlier this month.

The Oakland County prosecutor, Jessica Cooper, said Walker broke the law by hacking in to his former wife's account.

Walker says the computer was shared. His former wife claims it was hers alone.

Walker's lawyer said the prosecutor was "dead wrong" about the law.

"I've been a defence attorney for 34 years and I've never seen anything like this," Leon Weiss told the Detroit Free Press. "This is a hacking statute, the kind of statute they use if you try to break into a government system or private business for some nefarious purpose. It's to protect against identity fraud, to keep somebody from taking somebody's intellectual property or trade secrets."

"I have to ask: Don't the prosecutors have more important things to do with their time?"

Walker is due to stand trial in February.