Police in Santa Cruz, Calif., were trying to determine Wednesday what set off two shootouts that left two officers and a suspect dead on what the chief of police called "the darkest day in the history of the Santa Cruz Police Department."

The tragedy is the most brutal in a recent rash of violent crimes in the coastal city of 60,000 people about 70 miles south of San Francisco.

Police Chief Kevin Vogel said Sgt. Loren Butch Baker, a 28-year veteran of the force, and Detective Elizabeth Butler, a 10-year veteran, were shot and killed Tuesday as they followed up on a sexual assault investigation. Their ages were not released.

Santa Cruz County Sheriff Phil Wowak told the Santa Cruz Sentinel that the suspect, Jeremy Goulet, 35, was shot and killed about 30 minutes later in a barrage of gunfire with other officers just a few blocks away from where Baker and Butler were killed.

The officers had been following up on allegations that Goulet, a barista, made inappropriate sexual advances on a co-worker at her home last week, authorities said.

"Our department is in mourning; this is a horrific day," Vogel said. Baker was married and the father of two daughters, while Butler leaves behind two young sons.

"Tonight we are heartbroken at the loss of two of our finest police officers who were killed in the line of duty, protecting the community we love," Mayor Hilary Bryant said Tuesday night. "This is an exceptionally shocking and sad day for Santa Cruz and our police department. We offer our deepest sympathy and prayers to the families and the fellow officers of our fallen heroes."

Schools Superintendent Gary Bloom told the Sentinel that about 50 students and adults were present at the nearby Branciforte Small Schools campus, a home for alternative programs, when the shooting took place around 3:30 p.m. Gunshots were audible inside the building, he said.

Bloom said about 100 people were at nearby Branciforte Middle School, which was briefly locked down. Bloom said the schools opened Wednesday.

"We will be working with staff to talk kids through the trauma of this event," he told the Sentinel.

A store clerk a few buildings from the shooting said the final shootout was "terrifying."

"We ducked. We have big desks so under the desks we went," said the clerk, who spoke to the Associated Press on condition of anonymity and asked that her store not be identified because she feared for her safety.

The Sentinel said the shooting comes after several weeks of turmoil in the city, including a murder, a violent grocery store robbery, a home-invasion robbery, the shooting of a UC Santa Cruz student and the rape of another woman on campus.

Deborah Elston, co-founder of Santa Cruz Neighbors, told the Sentinel that the events of the last few weeks make her feel "like my freedom and safety are being challenged, I am also saying now is the time to be stronger. Sadly I hope this will wake people up to the truth about some underlying things going on in this community."