(CNN) The Fresno shooting rampage in which police say a black man killed three white men in an alleged hate crime took less than two minutes Tuesday.

But it was days in the making for Kori Ali Muhammad, already the subject of a manhunt in the death of an unarmed security guard last week, police said.

Muhammad, 39, is suspected of killing the guard, Carl Williams, on Thursday -- five days before he would be arrested in connection with the fatal shootings in downtown Fresno.

Kori Ali Muhammad, 39, is accused in four killings in Fresno, California.

One apparent motive in the downtown killings was that Muhammad had learned he was wanted in Williams' death, Fresno police Chief Jerry Dyer said.

"He made a decision to himself that he was not going to go to jail for shooting a security guard, that he was going to kill as many people as he could (Tuesday), and that's what he set out to do," Dyer said.

Police have said they think race was a factor in Tuesday's shootings, but they haven't discussed a motive in the guard's death. What led to that first killing, and what happened in the days afterward, are just some of the mysteries surrounding a case that has stunned the central California city of 500,000.

Shouts of 'Allahu akbar,' but racial motive suspected

Police say Muhammad shot three white men he didn't know on Tuesday morning, firing 16 rounds in 60 to 90 seconds within a block and a half downtown.

Kori Ali Muhammad was in custody Tuesday in connection with the shooting deaths in Fresno.

Zackary Randalls, a 34-year-old Pacific Gas and Electric Co. employee, was shot dead as he was riding in a vehicle with a colleague, the International Brotherhood of Electrical Workers said.

Mark Gassett, 37, and David Martin Jackson, 58, were shot near the Catholic Charities social services agency, authorities said.

Muhammad is also accused of firing at a 59-year-old white man coming out of a house, but he missed, the police chief said.

He allegedly pointed the gun at three Hispanic females -- a woman, her adult daughter and her 4-year-old granddaughter -- who heard the gunshots and got into their car, which then had trouble starting. Muhammad approached on the passenger side and pointed the gun at them but didn't fire, Dyer said.

Officers found Muhammad running on the street shortly after the last victim was shot. He surrendered to police, telling an officer, "I did it. I shot them," Dyer told reporters.

"You guys are looking for me," he also allegedly told them.

Police move near one of Tuesday's shooting scenes in downtown Fresno.

Muhammad had posted on social media a dislike for white people and government officials, Dyer said. He also yelled "Allahu Akbar" (God is greatest) when he was arrested, officials said.

Investigators do not know what Muhammad's religious beliefs are, but it doesn't appear he targeted anyone based on religion, Dyer said.

"We do not believe ... that this is a terrorist-related crime," Dyer told reporters. "This is solely based on race."

The FBI is assisting in the investigation.

Muhammad will face four counts of murder -- one in the guard's killing and three in Tuesday's deaths -- and two counts of assault with a deadly weapon, officials said.

Mourning in Fresno

Randalls had just joined PG&E as a customer service representative six weeks ago, said the IBEW 1245 local chapter to which Randalls belonged.

He was joining a colleague for a work-related ride-along when he was shot, the union said.

Randalls leaves his wife of eight years, Katie, a 3-year-old daughter and a 4-year-old son, his friend Jim Light told CNN.

"I don't even know how his wife is going to broach the subject with the kids (about) daddy's never (coming) home," Light said. "How do you explain that to two small children?"

Gassett was shot as he was walking away from Catholic Charities with a bag of food, said his mother, Rosie Wagner. He had "a heart of gold" and had two sons, ages 9 and 13, Wagner said.

"He had two beautiful little boys. He was a good-hearted person, very caring, very loving," a tearful Wagner told CNN on Wednesday. "Called me all the time, making sure that I was OK."

Stunned Fresno residents held hands and prayed during a vigil Tuesday.

Maria Praise told CNN she ran inside and locked the doors when she heard the sound of gunfire.

"I could hear the shooting. I saw the man running," she said.

"My niece saw one victim. She tried to do CPR. But when she touched him, he was already dead."

Of its slain employee, PG&E said: "Our hearts are very heavy as we have lost a member of our PG&E family."

Fresno Mayor Lee Brand called it "a sad day for us all."

"My thoughts and prayers are with the families of the victims. None of us can imagine what they must be going through."

Last week's killing

Carl Williams, an unarmed security guard, was shot outside a Motel 6.

Muhammad was being sought in what police called the "unprovoked" shooting death of Williams, 25, an unarmed security guard, outside the Fresno Motel 6 on Thursday.

Police haven't commented on Williams' race. They had published a photo of Muhammad, asked for the public's help in finding him and offered a reward.

Muhammad shaved his head and face to change his appearance, Dyer said.

Muhammad's background

Muhammad had prior run-ins with the law, court records show.

In 2005, he was indicted on charges of cocaine possession with intent to distribute, and possession of two rifles and a semi-automatic handgun.

His public defender raised questions on whether Muhammad was mentally fit to stand trial, noting that on several occasions, he had "appeared eccentric with some bizarre beliefs" and appeared to have hallucinations. The lawyer also said he'd had "at least two prior mental health hospitalizations."

A psychiatric evaluation found that Muhammad suffered from psychosis and a substantial degree of paranoia. He was declared not competent to stand trial in July 2005.

After an order committing him to a facility in October 2005, he was later found competent for trial in 2006.

Muhammad pleaded guilty and was sentenced to 110 months in prison, which was reduced to 92 months.