FRESNO, Calif. - A man who said he was fed up with racism against black people was convicted of killing four white men in a race-related rampage in California’s Central Valley, prosecutors announced Friday.

Kori Ali Muhammad was convicted by a Fresno County jury Wednesday of first-degree murder, second-degree murder, attempted murder and other crimes, the Fresno County district attorney’s office said.

On Friday, he withdrew a previous plea of not guilty by reason of insanity and prosecutors said they wouldn’t seek the death penalty. Muhammad is expected to be sentenced next month to life in prison without possibility of parole.

Muhammad, a black man whose defence said he was mentally ill, was accused of a series of shooting attacks on white men in April 2017 in Fresno.

In a recorded confession to investigators that was played at his trial, Muhammad said he shot Motel 6 security guard Carl Williams III and tried to kill another guard on April 13 because he felt he had been disrespected when he went to visit a friend.

A security camera recording showed Muhammad coming up behind Williams, 25, and shooting him.

“It starts taking its toll on you and you get fed up with the racism,” Muhammad said. “You get tired of letting things slide.”

While on the run after the shooting, Muhammad learned that he was wanted for Williams’ killing. On the recording, Muhammad said that if he was “going down for murder” the best thing was to “kill as many white men” as he could.

On April 18, 2017, Muhammad drove through downtown shooting at white men, he said. He surrendered to police after, at one point, firing nearly 20 shots in less than a minute, authorities said.

Zachary Randalls, 34, was shot in a Pacific Gas & Electric truck.

“When I walked up to the truck, I saw a Mexican driver and a white guy,” Muhammad said. “I didn’t want to target the driver because he was Mexican so I shot the white dude.”

He also was convicted of killing Mark Gassett, 37, and David Jackson, 58, and trying to shoot three other men.

Muhammad was convicted of first-degree murder for Jackson’s slaying; second-degree murder for Williams, Randalls and Gassett; four counts of attempted murder; one count of shooting at an occupied vehicle and one count of being a felon in possession of a firearm.