A Mojave Desert shooting ended Friday morning when police took down the gunman who led them on an hour-long car chase with two wounded hostages in his trunk near Ridgecrest, California. The suspect, 39-year-old Sergio Munoz, was thought to be involved in a separate homicide earlier that morning, and sped off when an officer followed him around 7 a.m. PDT.

"During the pursuit, the suspect fired at passersby, passing vehicles, and the officers pursuing him," Michael Whorf, a senior deputy with the Kern County Sheriff's Office, told Reuters. "The suspect started firing multiple times at different places as the vehicle was moving ... as he was driving."

According to The Star Tribune, at one point during the Mojave Desert chase, the car’s trunk popped open when Munoz pulled over, revealing the two hostages – one man and one woman – who were trapped inside. Kern County Sheriff Donny Youngblood recalled during a press conference that Munoz said he was going to shoot the two hostages in his car.

The incident ended around 8:15 a.m. when Munoz again pulled the car over on U.S. 395 and began to fire into the trunk where the captives lay. That’s when seven officers who were pursuing Munoz opened fire, killing the gunman.

The two injured victims, who suffered gunshot wounds, were taken from the trunk of the suspect’s vehicle and flown to a local hospital for treatment. They were listed in critical condition, but authorities expect them to survive, NBC News reports.

According to NBC News, Munoz had a history of convictions dating back to 1994. That year, he was sentenced to more than two years in prison for receiving stolen property. Most recently, the 39-year-old was arrested last Sunday for possessing controlled substance paraphernalia, in addition to a felony charge of possessing ammunition, after police found a syringe at his home.

On Friday, police were called in to the scene of a shooting in Ridgecrest, a relatively crime-free city of 28,000 people located in the Mojave Desert roughly 150 miles northeast of downtown Los Angeles, where a woman was found dead and a man was injured from gunshot wounds. According to the San Jose Mercury News, one of the officers got a call during the investigation from Munoz, who told the officer that he wanted to kill policemen, but because they had too many guns, he would “wreak havoc” in other ways.

Two hours later, a sheriff’s deputy spotted Munoz’s black Dodge Dart, and that’s when the chase began. The San Jose Mercury News reported that during the pursuit, Munoz ran traffic off the road and shot at least 10 times from inside his car with a handgun and a shotgun.

Authorities were not sure what triggered Munoz’s shooting spree, but they did say that the 39-year-old gunman was a heroin dealer and user. Munoz had also lost his job recently, according to the Associated Press.

Munoz had been staying at a friend’s house at the time of the shootout. The friend, Thaddeus Meier, later recalled how Munoz had told him Friday morning, “"We're going to reduce all of the snitches in town.”

When Meier refused to help him, Munoz opened fire, wounding Meier and killing Meier’s girlfriend.