A grass fire that burned nearly 500 acres on both sides of Interstate 580 in the Altamont Pass and created hours of traffic gridlock on July 8 was caused by a “safe and sane” firework set off by a 17-year-old boy who felt so guilty about what he had done that he called police and confessed, according to Alameda County officials.

The boy, a Manteca (San Joaquin County) resident, was driving over the Altamont Pass with friends Sunday evening when their car started to overheat. They pulled over to the side of the road to let the engine cool down. While waiting, they decided to set off some safe and sane fireworks, a category that includes fountains, sparklers, smoke balls and snakes, but not firecrackers or rockets.

A spark from one of the fireworks landed in the dry grass on the side of the road and started a fire, according to Alameda County sheriff’s Sgt. Ray Kelly. The boys attempted to stomp out the flames, but to no avail. As they drove away, they called 911 and later called the Manteca Police Department to tell them what had happened. The Manteca Police Department forwarded the information to the Alameda County Sheriff’s Office.

“Their conscience got the best of them, and they decided to do the right thing and hold themselves accountable,” Kelly said. “It’s not often that people come forward and tell us that they made a mistake.”

The Grant Fire started just after 5 p.m. near Grant Line Road in unincorporated Alameda County. It forced the California Highway Patrol to shut the freeway in both directions for several hours. It wasn’t until 9:30 p.m. that authorities reopened the westbound lanes. The eastbound lanes were opened an hour later. The traffic jam was so severe that some motorists fled by driving in the wrong direction along the shoulders of the gridlocked road.

More than a dozen agencies throughout the area responded to battle the blaze from the air and on the ground. The fire wasn’t fully contained until Monday morning.

It is illegal to use fireworks, including safe and sane ones, in all unincorporated areas of Alameda County. Kelly said that the sheriff’s department “empathized” with the juveniles but that the district attorneys office would still bring a case against them.

“This was a case of kids being kids, but they bit off more than they could chew,” said Kelly. “They were being mischievous and it’s hard to be mad at kids that come forward and do the right thing. At the same time, thousands of people were inconvenienced and a lot of local resources were put toward putting out the fire.”

A previous version of this story misstated the date of the fire. The story has been altered to reflect this change.