The police finally caught up to him at the end of the street, and he surrendered. In the back of a police car, Mr. Muhammad, 39, yelled “Allahu akbar,” Arabic for “God is great,” the police said.
Over the span of about a minute, Mr. Muhammad fired 16 bullets from a .357-caliber revolver over several blocks, killing three white men at random, the police said. When he was finally stopped by officers, he acknowledged he was a wanted man.
“He made a decision to himself that he was not going to go to jail for shooting a security guard and was going to kill as many people as he could today,” Chief Jerry Dyer of the Fresno Police Department said at a news conference. “That is what he set out to do.”
Chief Dyer said Mr. Muhammad had expressed anti-white views to detectives.
“He provided some very specific detailed information that caused our detectives to believe that this was motivated based on hate and not based on any terrorist act,” he said. “This is solely based on race.”
Mr. Muhammad, a drifter who went by the nickname “Black Jesus” and whose family had cut off contact with him, had been on the run since Thursday, the police said. Mr. Muhammad showed up at a Motel 6 in the city that day to meet a woman. But a security guard confronted him about being there, as he was not a guest.
Mr. Muhammad pulled out a handgun, fatally shot the guard and fired several bullets at another guard on a stairwell landing, the police said. The authorities saw him on security cameras at the motel but did not release his name and photo to the public until Tuesday morning.
Chief Dyer defended the department’s decision not to immediately release his name, saying that officers believed they were close to finding him. He also said he worried how Mr. Muhammad might react knowing that the police were looking for him.
The police on Tuesday were trying to piece together Mr. Muhammad’s whereabouts since Thursday but believe he was walking around on foot. His first victim on Tuesday was identified by The Fresno Bee as Zackary Randalls.
Those gunshots were picked up by the city’s gunshot detection system, and officers responded immediately, Chief Dyer said.
Not long later, Aaron Van Curen said he was working in his house on North Fulton Street when he heard a gunshot. When he peered outside, Mr. Van Curen said, he saw a gunman shoot a man two additional times. The victim fell.
Mr. Van Curen said he ran outside and checked for a pulse on the man, who was carrying a backpack and a bag of clothes, but could not find one. Around that time, Mr. Van Curen said he heard about five more gunshots in the next block, where the police said the last person was killed.
Mr. Muhammad is facing four counts of murder and two counts of assault with a deadly weapon, Chief Dyer said. The F.B.I. is also investigating the shooting as a possible hate crime or terrorism, according to court records filed late Tuesday by federal prosecutors
Mr. Muhammad, who the police said had previous arrests on drug and weapons charges and on charges of making a terrorist threat, indicated on Facebook that he had also spent time in Sacramento, where he said he attended high school. Seyed Ali Ghazvini, the imam at the Islamic Cultural Center of Fresno, said Mr. Muhammad was not a member of the mosque and called the episode an attack against the Muslim faith, The Fresno Bee reported.
In 2004, Fresno police officers found Mr. Muhammad, who was drinking in a car outside a house, with 10 grams of cocaine and two rifles. His lawyer in the case requested a psychiatric evaluation, which found he “clearly suffers from psychosis, with a substantial degree of paranoia” and said he was not competent to stand trial, according to court documents.
He was convicted and sentenced to more than seven and a half years in prison, and his probation required him not to have a gun for at least three years. Chief Dyer said the police were investigating how Mr. Muhammad got the handgun, which, he said, Mr. Muhammad tossed before he was arrested.
The authorities were spending time scrubbing Mr. Muhammad’s Facebook page, where he wrote often about his dislike of white people, calling them the “white devil,” and recently posted a photo of white people gathering near a lynching. He repeatedly posted, “#LetBlackPeopleGo.”
On Monday, he wrote on Facebook, “My kill rate increases tremendously on the other side.” Several times in recent days, he wrote on Facebook that he was in Atlanta, where he had some ties, in an apparent attempt to throw off the police. But the police said he probably never left Fresno, an agriculture hub in Central California, but he did shave off his dreadlocks to change his appearance.