(INSIDE EDITION) -- An Iowa woman who was accused of dumping her newborn baby in the trash pleaded guilty to lesser charges.

Ashley Hautzenrader, 24, gave birth to a baby in a University of Iowa Hospitals and Clinics bathroom on May 8, 2016.

Hautzenrader reportedly thought the child was dead and attempted to flush the infant down the toilet. She then left it in a pillowcase in the trash, cleaned the bathroom, and left, police said.

Hautzenrader reportedly told police she didn’t know she was pregnant but admitted to leaving the baby in the garbage.

The baby was found shortly after by hospital staff.

The 24-year-old pleaded guilty to child endangerment and to neglect or abandonment of a dependent person.

She was initially charged with attempted murder but that charged was dropped in exchange for Hautzenrader's guilty plea.

Hautzenrader faces up to 12 years in prison,

She will be sentenced at a later date.