SACRAMENTO — A Sacramento County Sheriff’s deputy was shot dead Wednesday and two California Highway Patrol officers were hit by gunfire during an investigation at a hotel into a stolen vehicle.

The CHP officers were approaching a room at the Ramada Sacramento on Auburn Boulevard around noon when a man inside reportedly opened fire with a high-powered rifle through the closed door and walls of his hotel room. The CHP officers were in stable condition and expected to survive, police said.

Robert French, a 21-year veteran of the sheriff’s department was shot after the suspect, whose identity has not yet been released, went to the balcony of his room and fired at several deputies below. French died on the way to the hospital.

The suspect then jumped to the hotel parking lot, drove off in a car and was shot during a chase and taken into custody, authorities said.

The incident began about 9:30 a.m. when officers with the Sacramento County Sheriff’s auto theft task force pursued a stolen vehicle they saw come out of the hotel parking lot. Investigators were following up on information suggesting that those behind a string of car thefts were working out of the hotel.

The occupants of the stolen car, two women whose names have not been released, refused to pull over and led their pursuers 20 miles to Elk Grove, where they were stopped and arrested.

Officers later went to the women’s room at the hotel, where the gunfight erupted.

The area around Auburn Boulevard along Interstate 80, near the Alister Mackenzie Golf Course, was closed to traffic and those staying at the hotel were told to shelter in place for several hours while dozens of officers searched the area for additional people who may have been involved. No one was found, and the area was deemed safe by 6 p.m.

French was 52 years old. He is survived by his live-in girlfriend, adult children and grandchildren.

“This is the most difficult thing any department can go through,” said Sacramento County Sheriff Scott Jones, who directed tactics from a makeshift command station near the Ramada.

Melody Guitierrez and Kurtis Alexander are San Francisco Chronicle staff writers. Email: mgutierrez@sfchronicle.com, kalexander@sfchronicle.com Twitter: @MelodyGutierrez, @kurtisalexander