MARTINEZ — A man who crashed head-on into an oncoming car and killed its teenaged driver as both of them were fleeing an illegal sideshow pleaded guilty to vehicular manslaughter last month, prosecutors said.

Atley Tafoya, 25, pleaded guilty to vehicular manslaughter and received a sentence of 240 days of house arrest, followed by three years probation. The sentence was offered by a Superior Court judge, not county prosecutors, according to a spokesman for the Contra Costa District Attorney’s office.

The charge stemmed from an October 2017 crash in which Tafoya, driving a U-Haul truck, allegedly swerved out of his lane and crashed head-on into a Mustang containing Miguel A. Ortiz, who was rushed to a nearby hospital. Ortiz, a teenager, died from his injuries five days later.

The collision injured four other people: Tafoya, two other teens in the Mustang, and a woman in the U-Haul. Ortiz was a passenger in the Mustang, authorities said. Tafoya and the two teens were seriously hurt and were hospitalized.

It all started with a sideshow in Bay Point, which involved more than 100 cars, police said at the time. It was big enough to attract the attention of the California Highway Patrol, whose officers showed up and arrested two people, both men in their 20s.

Both Ortiz and Tafoya were present at the sideshow and fled the area as police were arresting the two men, authorities said, before the fatal collision a few minutes later.