Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Four Idaho students angry over suspensions took revenge on their high school principal by burning down his house while he and his family were still inside, police said.

Mark Heleker and his wife and daughter were able to escape in time, Chief Mark Clark of the City of Payette Police Department told NBC News. But the accused teenagers were undone when they bragged on Snapchat about torching the house.

"They were describing how the fire had started and that information had not been made public yet," Clark said. "From that point on, we were able to determine who was making the comments."

The alleged criminal quartet — three high-schoolers and one middle-school student, all boys younger than 18 — are all in custody, Clark added. And two of them face first-degree arson charges that could send them to jail for life.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"In Idaho, arson automatically puts them in adult court," Clark said. "A conviction potentially carries a life sentence because the fire could have resulted in a death."

All four are also charged with conspiracy to commit arson, the chief said.

“It appears to be retaliation against the principal for a couple of them being suspended for the week prior for drug-related activity,” Clark said.

Heleker, who has been with the school district for more than two decades and is Payette's former mayor, was home with his wife Lorrie and their grown daughter early on Feb. 22 when a blaze started in a plastic trash can in the driveway quickly spread to the house, Clark said.

They managed to escape with their pets and a few possessions as the fire gutted their home and destroyed three cars that were parked in the driveway. Police later determined that several items have been stolen from the vehicles.

While arson was immediately suspected, it wasn't until Heleker's son saw the Payette High School students' boasts on social media that police were able to track down the alleged culprits.

“There was talk swirling around, and that kind of created a path to follow,” the now homeless educator told the Idaho Statesman.

The Heleker family is now living in a motel and driving cars borrowed from friends. Among other things, Heleker lost the collection of Green Bay Packers memorabilia he began collecting as a child.

"Somebody sent a copy of the story to the Green Bay Packers mentioning that he was a big fan and they sent him a box of memorabilia and a football signed by the whole team," Clark said.

Payette, which has a population of about 7,500, is 60 miles northwest of Boise.