OAKLAND (CBS SF) – An Oakland man pleaded no contest to voluntary manslaughter on Tuesday for fatally shooting a Stockton man in front of his home in East Oakland last year.

In entering his plea, Ibrahim Alhorsome, 23, took responsibility for the fatal shooting of 25-year-old Joshua Smith outside his home in the 1400 block of 74th Avenue at 8:08 p.m. on Feb. 8, 2018.

READ MORE: Passenger Killed In Crash On Highway 680 In Milpitas; Driver Arrested For DUI

The plea deal, which had been in the works for at least six weeks according to court documents, calls for Alhorsome to receive a term of nine years in state prison when he’s sentenced by Alameda County Superior Court Judge Morris Jacobson on Oct. 23.

Jacobson said at a brief hearing Tuesday that Alhorsome’s decision to agree to the plea deal shows that he’s “thinking rationally,” because if he had gone to trial and been convicted of first-degree murder and using a gun to kill Smith, he could have faced 50 years to life in state prison.

READ MORE: Optimism Soaring In San Francisco Bay Area As COVID Pandemic Woes And Worries Ease

Oakland police Sgt. Richard Vass wrote in a probable cause statement that Alhorsome and Smith got into an argument that “escalated with Alhorsome shooting Smith causing his death.”

Witnesses identified Alhorsome as the shooter and when police interviewed him, he admitted that he shot Smith, Vass said.

Alhorsome was arrested a few blocks away in the 7600 block of Lockwood Street at 10:22 p.m., about two hours after the shooting, according to Vass.

MORE NEWS: 'This Is Not Just Any Usual Recovery': Economist Explains Rash Of Price Hikes, Product Shortages

© Copyright 2019 CBS Broadcasting Inc. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. Bay City News Service contributed to this report.