A judge in Clarke County dismissed the case, saying the defendant didn't get a trial within a year of his arrest - as mandated by Iowa's right to speedy trial law.

"The county attorney's unavailability at the last hearing was the finale following unexplained periods of inactivity and lack of responsiveness that prevented disposition of this case within one year," Iowa District Court Judge Martha L. Mertz wrote this week in her order to release the defendant.

A timeline included in the judge's response indicates that Rivera was slow to get back to the defense team on several occasions. Three months ago, after getting an email from the defense about the status of a plea agreement proposal, Rivera responds saying she thought she was waiting on something from the defendant and that there is no trial date scheduled. "Sorry to have dropped the ball," she writes, according to the judge's decision.

It is unclear whether attorneys for defendants from other cases Michelle Murphy Rivera has prosecuted have filed similar motions. Rivera, a Democrat, lost her re-election bid for county attorney in November after serving two four-year terms.

According to a criminal complaint, she was arrested the afternoon of October 18 at the courthouse. Deputy George Barber III said he noticed that "Rivera was slurring her words and stumbling on her feet," and that he could "smell a strong odor of alcohol."

He asked her to step out of the courtroom and to take a breath test. She refused the latter, and Barber arrested her.

Rivera, 42, pleaded guilty to a public intoxication charge and paid a $65 fine, according to court records.

CNN reached out Thursday to Rivera and an attorney who appears to represent her but requests for comment have not been answered.

Rivera was also arrested last week on suspicion of operating a vehicle while under the influence and of child endangerment. Her first appearance in court was scheduled for Thursday.

In her November re-election bid, she was defeated when she received only 29% of the vote. She prosecutes every case in the county, which has about 10,000 residents; she does not have an assistant.

Rivera's first arrest came just before a hearing for the defendant in the sexual abuse case. The 23-year-old man had admitted to engaging in a sex act with a minor in August 2017, police records say. He was arrested the next month.