A New Jersey man who won a $338 million Powerball jackpot will be freed from jail while he awaits trial on charges he sexually assaulted a child.

A judge issued the ruling Monday during a detention hearing for 49-year-old Pedro Quezada.

Quezada will be electronically monitored and confined to his home except when traveling to see his lawyer and his financial adviser.

He was charged last week with sexual assault and child endangerment. His lawyer has said he's being targeted.

The accuser is now 20. She told authorities Quezada touched her breast, legs and other body parts when she was around 11 or 12, according to court documents. She said when she was around 13 or 14 he forced her to have sex after he bought her a flat iron for her hair.

Quezada worked at his bodega in Passaic before winning the lottery in 2013. He took a $152 million lump sum payment.

He faced legal trouble before his arrest.

He was once sued by a contractor who claimed he wasn't paid after doing renovations to a home Quezada owned. He also was accused of going back on his promise to help his neighbors pay their rent.