An off-duty Los Angeles cop pulled out his gun and fired a shot during an altercation with several teens this week — and some of the fight was captured in a cellphone video posted online Wednesday, authorities said.

The 9-minute video, which was posted on YouTube, shows the officer tugging on a 13-year-old boy as he tries to detain him around 2:40 p.m. on a residential street in Anaheim.

At one point, one of the teens runs into the officer, causing the cop to fall backward over a bush. Another teen steps in and appears to attempt to strike the cop.

The officer is still holding on to the 13-year-old and trying to pull him over the hedge when he takes out his gun. Moments later, a single shot rings out.

No one was injured by the gunfire, but Los Angeles authorities are investigating the incident. Two of the kids were arrested, the 13-year-old for allegedly making criminal threats and battery, and a 15-year-old for assault and battery.

Police told the Los Angeles Times that the 13-year-old allegedly threatened to shoot the off-duty cop.

In the cellphone footage, the 13-year-old appears to insist that he told the cop he was going to “sue” him, not shoot him.

The off-duty officer has not been arrested, and police say he is cooperating with the investigation, according to the newspaper.

“The confrontation began over ongoing issues with juveniles walking across the officer’s property,” Anaheim police said in a statement Wednesday.

The department added in a Facebook statement that the “videos posted online do not depict the entire event.”

“We have received reports of planned protests,” Anaheim police wrote. “Peaceful protests in accordance with the law are perfectly acceptable. Acts of violence or vandalism will not be tolerated.”