REDWOOD CITY (CBS SF) — A man who burst into a stranger’s home in Redwood City in April swinging his infant son by the leg pleaded no contest to child endangerment and battery charges this week on the condition that he be sentenced to no more than two years in prison, prosecutors said Wednesday.

On April 29, Jeremy Davis allegedly entered a home in the 900 block of Chatworth Lane at about 7:30 p.m., swinging his 7-month-old son by the leg, according to the San Mateo County District Attorney’s Office.

READ MORE: San Leandro Community Rallies for Reform on Anniversary of Steven Taylor's Police Shooting Death

He told the woman who lived there he had killed the baby and she convinced him to give the baby to her. He did, but then tackled her, causing her to fall over on top of the baby, prosecutors said.

The baby was mostly unharmed and suffered just a small cut to the head. The woman was uninjured.

The resident called 911 and when police arrived they found Davis outside standing in the middle of the street. He seemed to be on drugs and refused to obey the officer’s commands, according to prosecutors.

READ MORE: Lodi Parachute Center Skydiver Dies After Chute Gets Tangled on Descent

As he moved toward the officer with clenched fists, the officer fired a Taser at him, but it had no effect. Other citizens managed to subdue Davis and he was arrested, according to prosecutors.

He had to be sedated at the hospital because he remained combative.

His girlfriend told investigators that the couple had gotten in an argument and she left the baby in his care while she left to cool off, according to prosecutors.

Davis is scheduled to return to court on Aug. 19 for sentencing.

MORE NEWS: Saratoga Resident Displaced in 2-Alarm House Fire Sunday Morning

TM and © Copyright 2016 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2016 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. Bay City News Service contributed to this report.