A California woman charged with trying to drown her own baby after giving birth in a McDonald’s restaurant pleaded no contest to child endangerment Monday.

Sarah Lockner, 26, of Redwood City, faces up to four years in prison, KPIX-TV reported.

Lockner was a cashier at a McDonald’s in Redwood City when she went to the bathroom and gave birth during her shift on Sept. 4, 2017, authorities said.

CALIFORNIA RESTAURANT EMPLOYEE TRIED TO FLUSH NEWBORN DOWN TOILET: PROSECUTORS

A co-worker who went to check on Lockner found a newborn baby boy face down in the toilet bowl with Lockner’s hands on his back, prosecutors said. The co-worker said they heard the toilet flush but Lockner asked them not to call the police.

Police were called and found the boy had no pulse and wasn’t breathing. He was taken to a hospital and “after a medically induced coma” he survived, KPIX-TV reported.

FAST-FOOD WORKER CHARGED WITH TRYING TO KILL BABY IN TOILET

Lockner claimed she had no idea she was pregnant. She was charged with attempted murder but pleaded to the lesser charge. She is slated to return to court on May 3 for sentencing.

The Associated Press contributed to this report.