A drugs officer who was shot in the face during a traffic check held up a tube of K-Y Jelly lubricant during his assailant's sentencing in court and said: "You are going to need a lot of this."

Kevin Rojas, now 21, was branded a coward as he was sentenced to life for firing on the officer – not named because of his undercover work – during a traffic stop in Jacksonville, Florida in March 2016.

The officer, who was taking his child to school, was shot three times by Rojas, the court heard. He was hit in the head, stomach and hand after attempting to stop the suspect for erratic driving.

The child was not injured in the attack. Rojas fled the scene in a stolen truck.

According to the Florida Times-Union, Rojas barricaded himself in his home but was eventually shot and apprehended after pointing a gun at police officers through a glass door.

"I will take those bullets instead of a fellow officer and an innocent bystander," the officer told Rojas in court. "When I brought the fight back to you, you ran like a coward."

The detective testified in court in October about the incident.

He said: "Once we're stopped, I go to pick up my radio to call in the traffic stop but that's when I noticed the car door opening. When I see the car door opening, I start to look behind me to open my door. That's when I hear the gunshots and the glass shattering.

"As I clear the roof, he shoots me. I see him. He shoots me in the head. When he shoots me in the head, I get a whiplash. I see the blood splatter. At this time, I know — I realise I got shot."

Rojas was found guilty of attempted first-degree murder, attempted manslaughter, two counts of aggravated assault on a law enforcement officer, grand theft auto and fleeing. He was sentenced to life plus three 15-year sentences and two five-year sentences for the lesser charges.