OAKLAND -- A 32-year-old Oakland man found guilty of being an accessory to a felony connection with the killing of a 25-year-old at the Occupy Oakland encampment in 2011 was sent to prison Thursday for 35 years.

But Issac McDaniels' role in the shooting death of Kayode O. Foster wasn't the crime that sparked his lengthy prison term; it was a sexual assault McDaniels committed five days later against a 22-year-old that will keep him behind bars for more than three decades.

McDaniels prison sentence came as part of a plea deal in which he avoided a possible life term in prison in exchange for admitting he participated in Foster's killing and sexually assaulted a woman as she walked home alone from work.

"He has a sentence that reflects the seriousness of the violence of his offense," said deputy district attorney Tim Wellman. "The (sexual assault) victim was supportive of this disposition."

McDaniels was originally arrested for his role in the shooting death of Foster near the BART entrance on Frank H. Ogawa Plaza. The shooting occurred Nov. 10, 2011 at the height of the Occupy Oakland encampment and led to more residents demanding that the illegal tent city be taken down.

McDaniels admitted that he helped beat Foster and gave his gun to accused killer Norris Terrell, 20, before a fight with Foster began. That fight led to Terrell being accused of shooting and killing Foster.

Terrell was arrested and charged with murder, but McDaniels was never charged with murder because prosecutors did not have evidence proving that McDaniels knew Terrell was going to shoot Foster.

A jury trial against Terrell could begin later this year.

McDaniels faced only seven years in prison for his involvement in ¿Foster's death but soon learned that he faced a lifetime in prison for sexual assault.

That assault occurred about 1 a.m. Nov. 15 on East 25th Street as the woman walked home from work. The woman testified during a preliminary hearing that McDaniels followed her and then forced her into a secluded area before making her perform oral sex at gunpoint.

DNA collected at the scene was linked to McDaniels, and the woman identified him as her attacker.

McDaniels almost received a more lenient punishment after the Alameda County District Attorney's Office offered him a 16-year prison term, but the woman refused to agree, saying McDaniels deserved a more severe punishment.

McDaniel's attorney, David Bryden, declined to comment.