Two victims were being treated at hospitals and were expected to survive, police said (File)

A 33-year-old felon accused of killing four people and wounding two others in a stabbing spree in two Southern California cities "savagely attacked" his victims seemingly at random and unprovoked, police said on Thursday.

The suspect, Zachary Castaneda, was taken into custody on Wednesday evening outside of a 7-Eleven convenience store in Santa Ana, California, moments after stabbing to death a security guard there, police said.

Garden Grove Police Lieutenant Carl Whitney told reporters Castaneda "savagely attacked these people for some reason" in an unprovoked attack on victims ranging in age from 25 to 64 that stunned central Orange County residents and authorities.

"I've worked here for 30 years and I've never seen anything like this," Whitney said. "It is pure evil."

Two victims were being treated at hospitals and were expected to survive, police said. Those include a male victim undergoing surgery to have his nose reattached and a female victim who was wounded close to her heart, Whitney said.

The crime spree began when Castaneda stabbed two roommates to death on Wednesday afternoon outside the Garden Grove apartment complex where he lived, police said.

The suspect, who was driving a silver Mercedes, later robbed a bakery in Garden Grove and a check-cashing business while threatening victims with a knife, police said.

In nearby Santa Ana, Castaneda is suspected of attacking and fatally wounding a man in a Subway restaurant, police said, before killing the 7-Eleven security guard, using a knife to cut his belt and leaving the store armed with the man's gun.

As he left, police confronted the man and took him into custody, where he continued to be "combative" with officers, Whitney said.

Police said Castaneda had served prison time for possession of methamphetamine with an intention to sell while armed with a rifle and that they had previous contact with him in connection with a child custody dispute.