Steven Raymond Barba, 28, in a plea agreement with the District Attorney’s Office was allowed to use his time in county jail in San Jose as credit against a three-year sentence in state prison, defense attorney Thanh Ngo said.

Barba was convicted last month of stabbing Smith in the leg twice, wounding him superficially, at a party on June 30, 2012 thrown by Smith and his then-roommate, former 49ers tight end Delanie Walker at a rented luxury home outside of East San Jose, prosecutors said.

Judge Hector Ramon today imposed two concurrent three-year sentences of parole on Barba for assault with a deadly weapon and being a felon in possession of a firearm.

Ramon also sentenced Barba to three years in prison for the two crimes, but noted that Barba would not serve that time due his jail credits as part of a sentencing agreement with prosecutors.

Barba spent more than 560 days in county jail and with one day of good conduct credit for each day he served, he had 1,129 total days served, which made him eligible for parole, Ramon said.

Barba, with tattoos on his face, neck and arms, smiled at Ngo and his other attorney Lucy McAllister as he stood in court wearing jeans sagging beneath a gray shirt, his dark hair braided in a long ponytail.

According to prosecutors, Barba was at the 2012 party at Smith’s home where at one point, hundreds of people had gathered outside and the social gathering spun out of control.

Smith, after learning that a person brandished a firearm at a bartender, went to his garage and ordered people to leave.

Someone then fired three shots into the garage and missed Smith and others. Smith later told sheriff’s deputies he went to retrieve a firearm, came back to the garage and heard a person utter a “gang slur” at him.

Smith said he then told the people outside, “This is my house. I’m Aldon Smith” in an effort to get the crowd to disperse.

Someone then came forward and stabbed his leg twice, but did not seriously hurt Smith. He reacted by kicking the assailant and then noticed his leg was bleeding from the minor wounds when he reentered his garage, prosecutors said.

Walker then picked up a .45 caliber handgun, went out to the driveway and shot the gun into the air to cause whoever fired into the garage to flee.

But more gunshots from the crowd were fired in return, wounding two party guests, who would file lawsuits against Smith and Walker.

Smith identified Barba as the person who stabbed him after investigators showed him surveillance video of the attack.

Smith himself on May 21 pleaded no contest to three felony weapons counts after deputies investigating the 2012 party incident located in his home three assault rifles that are illegal in California. His sentencing hearing is set for July 25.

Barba’s criminal case will be back in court before Ramon on Friday when his attorneys will argue against a move announced today by prosecutors to require the defendant to register as a street gang member.

Ngo said that the requirement was never part of Barba’s plea agreement.

Prosecutors charged Barba with assault with a deadly weapon with an enhancement for allegedly being a gang member, two counts for being a convicted felon in possession of a firearm and misdemeanor counts of carrying a dagger and inflicting corporal injury.

Barba pleaded not guilty to the charges on April 30 prior to reaching the deal with prosecutors and changed his plea to no contest in June.