Police body cam footage shows the moment a Colorado man spat on an officer, then struck him with a car after being ticketed for leaving dogs in a hot car while he sat in a restaurant.

Boulder police responded to a call on July 21 at 8:30 p.m. The two dogs were allegedly locked inside a hot, black Pontiac coupe, The Daily Camera reported.

Officials found the dogs panting and with no water.

Clint Martinez II, the animals' owner, agreed to come outside the restaurant. The 21-year-old man was given a warning on the condition that he take the dogs home.

Martinez told police he first had to pay his bill, but a half-hour later they spotted the man, then eating an ice cream cone, leaving the building through another exit.

Police ticketed Martinez but instead of leaving, police body cam showed him spitting on the officer. When they tried to open the door to pull him out of the car, he threw the vehicle into reverse, striking an officer and nearly hitting a passing bicyclist.

The officer was treated for non-life-threatening injuries.

Martinez was arrested Wednesday and charged with two counts of felony assault on an officer and two counts of misdemeanor assault, obstructing an officer and resisting arrest.

The Associated Press contributed to this report.