A gunman on a bicycle ambushed a rookie policewoman in northern California, shooting and killing her from the shadows. He then reloaded and narrowly missed wounding others before walking home and watching the chaos he had caused, police said.

The man who killed Officer Natalie Corona in the small college town of Davis on Thursday night later killed himself in a house. Police do not know the motive for the attack, police chief Darren Pytel said on Friday. The man’s name was not released.

Corona, 22, died within minutes of arriving at the scene of a three-car accident. She was shot in the neck and then several other times as she lay on the ground.

“We’re speculating that she never even saw him,” Pytel said.

Christian Pascual, 25, was one of the drivers involved in the crash. He had handed Corona his license and she was returning it when he heard shots from close behind his right shoulder.

“The person was behind me,” he told the Sacramento Bee. “When I looked up and I saw the officer on the ground, he was already walking due west … just shooting at what looked like random people to me.”

The gunman shot at a firetruck, a bus and a house, pausing to reload. Nobody was wounded, although a firefighter was struck in a boot as he ran and a girl later found a bullet lodged in a textbook in her backpack, the police chief said.

Shaun Kingston, 39, saw the gunman shoot at the firetruck, “dump a clip and put another one in” and begin calmly walking away. Kingston, who followed at a distance, lost him in the crowd.

“He was just calm, cool and collected about it,” he said. “It was pretty damn disturbing seeing someone do that and just walk away.”

Police had previous contact with the man, but nothing suspicious or indicating he had mental issues, the chief said. Last year, the man reported being a victim of a crime. The chief said that after the shooting, the killer “basically circled the block and went home”. At the rental home a few blocks away, he chatted and hung out with his roommate.

“He didn’t show any sign that he was involved in the incident,” Pytel said, and even went outside to watch as police began rushing to the shooting scene. The gunman left behind a backpack that helped police track him to the house. The chief said as police began to surround it, he stepped outside wearing a bulletproof vest.

“He shouted some stuff, went back in and came back out with a firearm, then went back inside, pushed a couch in front of the door and officers heard a gunshot,” Pytel said. Police sent a robotic camera in and found the gunman had shot himself in the head. Police never fired, Pytel said. They found two semi-automatic handguns in the home.

The shooting devastated the Davis police department. Corona was the first officer to die in the line of duty since 1959. She had only been patrolling solo for about two weeks, the chief said, adding that from the janitor to the police chief, Corona “just wanted to be everybody’s friend, and was”.

Governor Gavin Newsom issued a statement saying the officer died “protecting her community from harm”. A candlelight vigil was scheduled Saturday night.

The attack occurred in a residential neighborhood near a park that hosts a farmer’s market. Residents placed flowers at a memorial outside the police department, where flags flew at half-staff. Corona’s colleagues, family and friends mourned a vibrant life.

“She was the best of us,” said Officer Mike Yu, after placing a “Blue Lives Matter” flag at the crime scene, about a mile from the police station.

As the eldest of four daughters, Corona grew up dreaming of becoming a law enforcement officer like her father, said her cousin, Emily Gomez, 26.

“I don’t remember her talking about anything else than wanting to become an officer,” said Gomez, who said her cousin was an athletic star in high school, excelling in volleyball, basketball and track and grew up in a tight-knit family in the town of Arbuckle.

Corona’s father, Jose Merced Corona, spent 26 years as a Colusa county sheriff’s sergeant before retiring and getting elected to the county’s board of supervisors last November. Her mother is a first-grade teacher, and two cousins are also in law enforcement, Gomez said. Corona graduated from the Sacramento Police Academy last July and completed her training just before Christmas, officials said.

“She was very proud,” her father told Fox40-TV, choking back tears. “She would come home, she would be beaming. She died doing what she wanted to do, what she loved.”

He pinned the badge on his daughter at her swearing-in ceremony in August.