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

An off-duty Los Angeles police officer believed his life was in danger when he fired his weapon into the ground — not at any person — during an altercation with a group of teenagers that sparked a rowdy protest at the officer's home, authorities said Thursday.

Police said five adults and 18 juveniles were arrested in the protest Wednesday night at the home of the officer, who wasn't arrested and is on administrative leave pending investigations in Los Angeles and Anaheim, 25 miles southeast.

The protest was sparked after a cellphone video of the confrontation, which occurred Tuesday in Anaheim, was published on social media. The video appears to show the officer holding on to a teenage boy while being jostled by his friends.

Related: Protests Erupt After Off-Duty Cop Fires Gun During Clash With Teens

The tussle continues until the cop pulls the pair into a hedge, where he draws his weapon and fires it. The video doesn't show how the confrontation began or what led to the incident.

The 13-year-old boy was arrested and released after being booked and examined at a hospital for possible bruises. He was charged with criminal threats and battery. A 15-year-old friend who was arrested on suspicion of assault and battery was released to his parents.

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

The boys were arrested — but the officer wasn't — after investigators interviewed the officer, his father and 18 juveniles at the scene, Anaheim Police Chief Raul Quezada said Thursday.

"There was a high degree of consistency in the information that we received in the interviews," which indicated that the officer legitimately believed that the younger boy "was going to shoot him," Quezada said.

The interviews also indicated general agreement that the officer didn't fire his weapon at anyone, Quezada said. Instead, he discharged it into the ground, he said.

Protesters march toward an off-duty Los Angeles police officer's home Wednesday night in Anaheim, California. Joshua Sudock / AP

The officer was released because "there was insufficient evidence at the time to prove" that he had acted illegally, the chief said.

"Thank God that no one was hurt," said Quezada, who said he was "concerned as a father" but was duty-bound to review the case impartially and to follow it wherever the evidence led.

Anaheim and Los Angeles police alike said the confrontation stemmed from a long dispute with several juveniles who won't stop walking across his lawn.

The 13-year-old boy, whom NBC News isn't identifying because he's a juvenile, told NBC Los Angeles that he actually told the officer that "I was going to sue him" — not shoot him.

The boy said he and two friends, a boy and a girl, were walking together when the girl started walking on the officer's yard, "and he started calling her names, like, cussing at her."

"I was like: 'Ay, that’s not how you treat a woman. Like, you could have asked her nicely,'" the boy said. "And then I think he got mad and he came at me."

Protesters march toward the off-duty officer's home late Wednesday in Anaheim, California. Joshua Sudock / AP

The boy said the officer fired his weapon "behind my back. ... It was close enough to, like, I felt the air. I felt the bullet just go."

"I thought I was going to die right there," he said.

Anaheim Mayor Tom Tait said Thursday that he'd also seen the video and understood why people turned up at the officer's home to protest. He said he supported the protests as long as they remained peaceful.

"This has been a blow to our community," he said. "What the world saw in that video does not reflect the community."

Tait said he had fielded numerous questions about "why the kids were arrested and the guy with the gun was not arrested."

"I share that question. I understand how you feel," he said. "But violence has no place in our city and will not be tolerated."