TRACY (CBS13) – An attempt to speak with an oddly-behaving man suddenly devolved into a violent fight Thursday when a suspect grabbed an officer’s service weapon, leading to a prolonged struggle and injuries to both the officer and suspect, authorities said.

The Tracy Police Department said an officer made contact with a Hispanic male dressed only in underwear in a residential neighborhood on Hawthorne Drive, but without any provocation, the man lunged at the officer and tried to wrestle his handgun out of his holster.

READ MORE: Sheriff: 1 Dead After Plane Crash Along Shore Of Clear Lake

Authorities said the man, identified as 31-year-old Samuel Flores De Ramos, had previously threatened to take an officer’s gun and force police to kill him during an encounter with Tracy officers on January 31. In that incident, officers transported him to the hospital for treatment.

Caught off guard by the assault Thursday, the officer used one hand to hold his gun in his holster and the other to strike back while both men fell to the ground. Authorities said the situation warranted the use of deadly force, but the officer instead used “alternative defensive tactics” to keep the suspect away from his weapon.

READ MORE: 15-Year-Old Suspected Of Pointing Gun At Other Student During Fight In Marysville High Bathroom

The melee raged for two and a half minutes before additional officers arrived on the scene. It eventually took five officers to gain control of Ramos and take him into custody, authorities said.

Despite the violent encounter and disturbing mugshot of Ramos, authorities said the suspect only suffered abrasions and contusions and is expected to recover.

The officer was also wounded and has not been medically cleared to return to duty.

MORE NEWS: Wanted Attempted Homicide Suspect In Custody After Chase, Crash In Roseville

Ramos is in custody of the San Joaquin County Sheriff’s Department on a number of charges, including assault on a police officer and attempting to disarm an officer.