A man, already struck by a car on the I-5 freeway in Irvine, told a California Highway Patrol officer Monday night that he had a gun and went into “a shooting stance” while standing, before the officer shot him, the agency said Tuesday.

The officer, who fired an undisclosed number of shots, immediately began CPR until medics arrived, a CHP spokesman said, but the man died.

Besides the gunshot wound, Mauricio Barron, 27, of Riverside, suffered from traumatic injuries, apparently from getting hit by the vehicle. Coroner’s officials said a cause of death had not yet been determined.

“At this stage of the investigation, we believe the pedestrian was trying to take his own life and, after being struck by a vehicle, presented himself in a manner to the officer to intentionally force the officer to shoot at him,” said Officer Paul Fox, a CHP spokesman.

After receiving a call of a man running in the northbound lanes, near the 133 toll road, officers arrived to see Barron switch freeway sides, Fox said, “behaving erratically” and trying to jump in front of vehicles “and observed him get hit.”

Hours earlier on Monday, at about 11:40 a.m., CHP officers investigated a carjacking in Riverside on the 91 freeway. They now believe the suspect was Barron, who was being driven to a Loma Linda mental health hospital by a friend.

“It was reported to investigators that the suspect had been acting abnormally for the last two days,” Fox said.

During the drive, the suspect threatened his friend with a butcher knife and the friend pulled over near Central Avenue and got out. The suspect drove off.

Irvine police found the ditched stolen car and began to search for Barron. His sister, Karla, had posted on social media that her brother was missing in that city.

The officer who shot Barron has been with the department about seven years and is on paid leave, a standard practice after law-enforcement shootings.

Fox declined to discuss whether a weapon was found at the scene. He also said the coroner’s office would determine if the man was under the influence. As with all shootings involving law enforcement, the case will be investigated by the District Attorney’s Office.

Karla Barron shared a video on Facebook of a tearful woman who identified herself as the victim’s mother, Leticia Barron, in front of the hospital Monday night.

“The police departments all were notified that he was unstable and he ended up on the freeway,” the woman said. “We want answers!”

Contact the writer: 714-796-7865 or afausto@scng.com