SAN DIEGO — Officials Thursday identified the California Highway Patrol officer shot on a San Diego freeway this week, saying he is expected to survive and be released from the hospital soon.

Tony Pacheco, a seven-year veteran of the department, was shot in the leg after a driver lunged at him in an “unprovoked attack” and tried to take his gun, CHP officials said in a news conference. The gun fired once, hitting Pacheco, but officials have not definitively said who pulled the trigger.

The man suspected of attacking the officer, identified as 25-year-old Yuhao Du of San Diego, was taken into custody with help from bystanders.

Pacheco was taken to Scripps Mercy Hospital San Diego, where he was initially listed in “serious but stable” condition. He has since been upgraded to “stable,” according to CHP Capt. Taylor Cooper.

Cooper said that when he visited Pacheco at the hospital Wednesday night, the officer was in a lot of pain but was in “good spirits” and “very grateful” for the response of law enforcement and the public’s assistance. Pacheco is expected to be released from the hospital in a day or two.

“Tony is very lucky to survive,” Cooper said.

The captain also praised the bystanders who helped take Du into custody.

“Without the public, this may have a different outcome,” he said.

The San Diego Police Officers Association, a union representing local officers, shared a GoFundMe campaign for Pacheco Thursday.

“His injuries will require a lengthy rehabilitation and potential surgeries,” the fundraiser’s organizer wrote, adding funds will pay for child care costs, meals and transportation for Pacheco’s family members.

Du faces charges of first-degree attempted murder, assaulting a police officer with a firearm, taking an officer’s firearm and causing great bodily injury, according to jail records.

Cooper said officials were investigating whether mental health issues, drugs or alcohol played a part in the attack.

FOX 5’s Dillon Davis contributed to this report.