A San Francisco police officer shot and killed a suspected carjacker who had injured a state lottery worker, stole her minivan and led police on a chase into a public housing complex in the city’s Bayview neighborhood on Friday, officials said.

The chase came to its deadly end inside the Alice Griffith Housing Development Double Rock, near the Gilman Playground and the Bret Harte Elementary School, police said.

The episode began about 10:30 a.m. when police responded to reports that the driver of a California State Lottery van was carjacked in the 1800 block of 23rd Street in Potrero Hill, said Sgt. Michael Andraychak, a San Francisco police spokesman.

The woman driving the van suffered “non-life-threatening injuries,” he said.

Witnesses told police a gold-colored sport utility vehicle drove away from the scene, and officers spotted both the van and the SUV “traveling together down the streets of the Bayview district,” Andraychak said.

Police officers stopped the gold-colored SUV at Gilman Avenue and Ingalls Street. The men in the vehicle were detained without incident.

While police handled the men in the SUV, additional officers chased the white lottery van into the housing complex to Griffith Street and Fitzgerald Avenue, police said.

The driver hit a fence and got out of the van, at which point at least one officer opened fire, police said. It was not immediately clear whether the man was armed.

A patrol car stopped behind the lottery van had a shattered front passenger-side window, but police did not say how it was broken.

The suspected carjacker, identified by the city medical examiner’s office as 42-year-old Keita O’Neil, was taken to San Francisco General Hospital, where he was pronounced dead. Back at the scene, police examined bloody clothes and other evidence scattered between the patrol car and van.

The van, which was filled with boxes, was surrounded by crime scene tape and its rear hatch was raised.

The names of those arrested were not released.

Andraychak said the officer who was involved in the shooting was wearing a body camera and that investigators will review the footage. The officer’s name was withheld by police, pending further investigation.

State lottery officials declined to say what the van was transporting and referred questions to the San Francisco Police Department.

Russ Lopez, a lottery spokesman, said that the driver was not seriously injured in the carjacking.

“She’s shaken up, but we’re glad she’s OK,” Lopez said.

San Francisco Chronicle staff writer Annie Ma contributed to this report.

Evan Sernoffsky is a San Francisco Chronicle staff writer. Email: esernoffsky@sfchronicle.com Twitter: @EvanSernoffsky