A San Bernardino County sheriff's detective is in stable condition after he was shot during a criminal investigation near Palmdale on Wednesday afternoon, authorities said.

The shooting occurred shortly after 3 p.m. in Littlerock where authorities said the detective and a suspect exchanged gunfire while an investigation was underway. Both the detective and the suspect were struck.

Video from the scene showed a white SUV with shattered windows and apparent bullet damage. Propane tanks and a long gun were visible inside the vehicle. Nearby, an unmarked San Bernardino County Sheriff's vehicle showed signs of gunfire damage, and a bulletproof vest lay on the ground.

Los Angeles County Sheriff Robert Luna said deputies responded to assist after the shooting.

"Obviously, the suspect sounds like he was armed and dangerous, and he was willing to shoot it out with the police, and that's a very dangerous individual in my opinion," Luna said.

The detective, described by officials as a veteran investigator in his 30s who has been with the department since 2014, was airlifted to Antelope Valley Hospital in Lancaster.

"Transporting our deputy by air is critical in terms of being able to save their life and get him to those life-saving measures at hospitals like Antelope Valley ... very thankful for that and they also stabilized the deputy on that flight," San Bernardino County Sheriff Shannon Dicus said.

Authorities said the detective was shot just below his lower rib cage and underwent surgery. Investigators said Wednesday evening that he was in stable condition and is expected to recover.

Meantime, the suspect died at the scene.

Officials said there is no threat to the public. Los Angeles County Sheriff's homicide detectives are investigating the circumstances that led to the shooting.

Authorities have not released details about the criminal investigation that preceded the shooting.

Investigators also have not disclosed what weapon the suspect used or provided additional details about how the exchange of gunfire unfolded. Officials said the focus remains on the detective's recovery.

Anyone with information is being asked to contact the L.A. County Sheriff's Department's Homicide Bureau at 323-890-5500.