CAMPO, Calif. (KGTV) — An East County man who admitted to jumping onto a school bus full of children and pulling a knife on the driver was sentenced Tuesday.

Matthew Douglas Barker, 37, was sentenced to four years probation, including time at a long-term residential drug rehabilitation facility. He pleaded guilty in December to assault with a deadly weapon and misdemeanor child endangerment for the May 2018 incident.

The judge took into consideration that Barker was remorseful and took responsibility for the incident. He also took into consideration that the mother of Barker's two children, who were on the bus during the incident, died of Leukemia in 2017 and led to a drug relapse.

RELATED: Campo resident who tried to hijack school bus pleads guilty

Barker will also have to complete grief counseling and parenting courses at the rehab facility. If he violates his probation or has a drug relapse, the judge said he could serve jail time.

Barker was arrested on May 25, 2018, after police said he stormed onto a school bus and demanded the driver leave. After a grandmother saw what was happening, she boarded the bus and tried to help the driver prevent Baker from making his way further onto the bus.

That's when police say Baker pulled a knife on the driver and took a swing at him.

RELATED: Good Samaritans wrestle armed man off school bus filled with Campo Elementary students

At the time, Baker said he was using methamphetamine and believed that drug cartel members were out to kill his children.

During the struggle, an older student began ushering children out of the back of the bus and called nearby parents for help. Another Good Samaritan boarded the bus and helped control Baker until San Diego County Sheriff's deputies arrived.

The judge Tuesday hailed the 78-year-old bus driver for his heroic actions to prevent Baker from making it further onto the bus. He also acknowledged that Baker was not in the proper state of mind and wants to give him a chance to get sober.