A Michigan teen who shot his friend with a pellet gun in a prank gone wrong was ordered to serve time in jail, according to reports.

William Caserta, 18, was sentenced Thursday to four weekends in jail and 18 months of probation for an incident which critically injured his 17-year-old friend, MLive reported.

The teen pleaded guilty to felonious assault for shooting Logan Perez in an ambush Oct. 6 outside a Summit Township home.

Caserta and four other friends reportedly were under the impression another group planned to toilet-paper a friend’s house. They waited outside the home where Caserta positioned himself on the roof with a pellet gun.

Perez was shot in the prank and rushed to a local hospital, where he underwent emergency stomach surgery, officials said.

“The pellet went between my ribs, hit my liver, my pancreas and lodged in my stomach,” Perez told the court. “My friend saved my life telling me I needed to go to the hospital.”

The victim’s mom, Sally Perez, testified that she believed the shooting was not an accident.

“This was beyond an accident,” she said, according to MLive. “The doctor told me [the wound] was one millimeter away from taking Logan’s life.”

Caserta apologized to the victim and his family at his Thursday sentencing.

“Words cannot express how sorry I am for Logan and his family,” he said.