The police officer that was critically wounded in a Halloween night shootout in the Castro is inching closer to recovery, internal police emails obtained by Mission Local indicate.

Officer Shawn Kai Hintzen, aged 41 and a nine-year veteran of the police department, was undergoing surgery on his intestines on Thursday morning. He had shrapnel removed from his stomach, and was “in and out of consciousness” on Thursday afternoon, according to the emails.

“His abdomen was clean of bacteria and the doctors were able to stitch him up,” Officer Joe Lynch of the Crime Scene Investigation Unit wrote in an email.

At a Wednesday afternoon press conference, police spokesperson Officer Grace Gatpandan said he was in critical, but stable, condition.

The emails also indicate that Officer Samuel Fung was working with Hintzen the night of the shooting.

“Let’s not forget Sam as well he is also as much of a victim of this shooting as Kai,” Lynch wrote. “They both were under extreme stress and performed valiantly.”

The officer’s name was confirmed to Mission Local by SFPD personnel and the email in which he was named.

The shootout broke out just after midnight on Wednesday near 18th and Diamond streets. Police said Hintzen and his partner were working a foot patrol in the area when a citizen asked them to check out a “suspicious vehicle,” a grey Chrysler sedan that police later said had been reported stolen.

When Hintzen approached the car, an exchange of gunfire ensued, leaving both Hintzen and the suspect critically injured from gunshot wounds, police said. They have not said who shot first, how many shots were fired, or whether other officers were involved in the shooting.

The suspect, who police haven’t identified, was in life-threatening condition on Wednesday afternoon, Officer Gatpandan said.

Police said the incident is being investigated in relation to the carjacking of a taxi, which took place minutes after the shootout near Diamond and Market streets. Three other suspects — two females of unknown age and a man in his 20s — held up the driver at gunpoint, drove off with the car, and left it on Oakwood Street.

Gatpandan said Wednesday that police will release details of the incident as they come, as their investigation is ongoing.