A San Francisco police officer was critically injured, but was expected to survive, after being shot in the head Friday night, officials said. An injured suspect was also in custody, according to police.

The officer — the first San Francisco police officer shot in the line of duty in nearly 10 years — was injured about 8:15 p.m. near the Lakeshore Plaza shopping center at Sloat Boulevard and Everglade Drive while responding to reports of a mentally disturbed person, police said.

The officer, who was not identified, was at San Francisco General Hospital in critical condition, said hospital spokesman Brent Andrews. The officer is expected to survive, Officer Carlos Manfredi said. The suspect also was at S.F. General.

Officer Giselle Talkoff, a spokesperson for the San Francisco Police Department, issued a statement early Saturday describing the wounded officer as conscious and with his family members.

“Our thoughts are with our injured officer and his family,” SFPD Interim Chief Toney Chaplin said in a statement Saturday. “Our officers each day put their lives at risk to protect and serve San Francisco and we are grateful for the outpouring of support we saw Friday evening from San Franciscans who were concerned for the officer’s well-being.”

Mayor Ed Lee visited the officer at the hospital and said he looked and sounded alert.

“I had a chance to thank him and meet his family. I’m very grateful,” Lee said.

Manfredi gave this account of the encounter: Officers responded at 8:15 to reports of a mentally disturbed man at Sloat and Everglade, and attempted to confront the man, who pulled out a handgun and started shooting at the officers. One officer went down, another stopped to help and remaining officers chased the suspect into Stern Grove. Officers fired shots at the man as he fled. He went down and still had the gun near his chest, and refused to surrender. Police distracted him with flash-bang grenades, took him into custody about 9:40 and he was taken to the hospital.

Martin Halloran, president of the San Francisco Police Officers Association, said he was with the injured officer at the hospital Friday night.

“This brave officer was doing his job, protecting the citizens of San Francisco, when he was struck by a bullet tonight,” Halloran said in a statement. “For his courage, he deserves all our gratitude and respect. Please keep him in your prayers tonight.”

Sean Dizon said he saw the aftermath of the shooting unfold outside of his window. About 8 p.m., he heard three gunshots while inside his home at the corner of Sloat Boulevard and Everglade Drive, he said.

When he looked out of the window, he said he saw one officer running and limping after a suspect, and a second officer being placed in an ambulance with his head bandaged.

The scene was out of the ordinary for the “very quiet people” who live in the residential area, he said.

Workers at Lakeshore Plaza said police scoured the area searching for the shooter.

Michael Gilbert, a 19-year-old employee at the plaza’s Subway, said officers came inside the restaurant and told him to close early.

“We just noticed a bunch of police coming. They asked us to lock up,” he said. “At first, I didn’t know what was going on. I was alarmed.”

An employee at Nubi Yogurt said scared bystanders standing outside ran into the frozen yogurt store as they noticed the police activity.

Police entered the establishment looking for the suspect before his arrest, the employee said.

The last SFPD officer shot in the line of duty was Bryan Tuvera, who was killed on Dec. 23, 2006.

Chronicle staff writers Nanette Asimov and Santiago Mejia contributed to this report.

Jenna Lyons is a San Francisco Chronicle staff writer. Email: jlyons@sfchronicle.com Twitter: @JennaJourno