BREVARD COUNTY, Fla. -

An undercover Brevard County Sheriff's deputy said he had to shoot a man who hit him with a car after a drug buy.

Deputies said around 1 a.m. Saturday morning, Deputy Juan Vargas was undercover at 5000 Friday Road in Cocoa, conducting a drug investigation.

Deputies said Vargas was undercover and attempted to buy drugs from 20-year-old Nicholas Lechner and another person in a car.

As uniformed deputies approached to secure the scene, Lechner ignored deputy's commands and attempted to flee the scene, deputies said.

When Lechner hit the gas, he intentionally drove the car a dangerous manner striking Vargas, placing him in fear and forcing him to take immediate action, deputies said.

Vargas discharged his firearm, striking the passenger, deputies said.

Deputies arrested Lechner without further incident, authorities said.

Deputies said the passenger was transported to Holmes Regional Medical Center after receiving one gunshot wound and is expected to recover.

Vargas was taken to Viera Hospital where he was later released.

Deputy Juan Vargas has been employed as a Deputy Sheriff with the Brevard County Sheriff’s Office since 2005. He is currently assigned to the Tactical Team and is also a member of the SWAT Team.

Deputies said Lechner was arrested and charged with aggravated battery of a law enforcement officer and was taken to the Brevard County Jail.

He is currently being held in the Brevard County Jail Complex on a No Bond status.

The passenger is not being identified at this time.

The Florida Department of Law Enforcement is conducting an independent and parallel investigation regarding the use of force. Further charges relating to both the driver and passenger are pending the investigative findings.

“Our deputies are trained to respond to deadly situations and must make split second decisions in the worst situations to protect themselves and others. Deputy Vargas is one of our finest and is highly respected by myself and his peers as an outstanding law enforcement officer. We are very thankful that Deputy Vargas was not seriously injured as a result of the suspect's actions,” said Sheriff Jack Parker.

Deputy Vargas has been placed on administrative leave pending the outcome of the investigation.