A California Highway Patrol officer was recovering Friday from a gunshot wound he suffered during a struggle with a motorist who allegedly tried to grab the officer's gun after getting into a solo accident in the Mission Valley area of San Diego.

The events that led to the shooting began about 6:15 p.m. Wednesday, when Yuhao Du, 25, of San Diego crashed his vehicle on eastbound I-8 near the I-805 overpass, according to the CHP.

A short time later, CHP Officer Antonio "Tony" Pacheco pulled over alongside the freeway at the site of the wreck and contacted Du, who was standing in the center-median area, CHP spokesman Jake Sanchez told CBS San Diego.

As Pacheco was speaking with him, Du allegedly attacked him without warning, "lunging for his service gun" and "trying to take control of it," Sanchez said.

Pacheco was shot in the thigh during the attack.

"The struggle continued, at which point several passing motorists stopped to assist the injured officer by providing medical aid and restraining Du until additional law enforcement personnel arrived," Sanchez said.

One of the motorists who assisted Officer Pacheco is reportedly a nurse who stopped the bleeding with a makeshift tourniquet.

Du was booked into San Diego Central Jail on suspicion of attempted murder of a peace officer, assault with a firearm causing great bodily injury and attempting to take a law officer's gun.

Officer Pacheco is expected to be released from the hospital in the coming days and make a full recovery.