Two teenage girls died and three other teenage girls were critically injured after a car crashed into a tree that caught fire early Sunday morning in Sacramento County, according to the California Highway Patrol.

The crash happened around 12:29 a.m. on Scott Road north of Latrobe Road. CHP said speed was a factor in the crash.

According to CHP, a 16-year-old girl driving the car and a 14-year-old girl in the front passenger seat died at the scene. The vehicle became fully engulfed in flames after the crash.

First responders were alerted to the incident through an iPhone crash notification, according to CHP.

Before emergency crews arrived, passing drivers stopped to help and were able to pull the three rear-seat passengers from the burning vehicle, CHP said. Firefighters provided medical aid to the injured girls once they arrived at the scene.

CHP said two of the injured girls are 16 years old, and the third is 15 years old. One passenger was taken to UC Davis Medical Center, another to Mercy San Juan Medical Center and the third to Kaiser Permanente South Sacramento.

CHP said investigators do not yet know whether drugs or alcohol were factors in the crash.

WATCH ALSO: Residents safely evacuated after heavy fire spreads through apartment complex