Los Angeles, California (CNN) -- Oakland, California, police Friday moved to stop unruly marchers upset at a two-year sentence for a former transit police officer convicted in the killing of an unarmed man, the chief said.

The group marched down several streets, being stopped by police several times before heading another direction. The group broke an agreement on where it would go after an earlier rally and went another direction, Poilce Chief Anthony Batts said.

Batts decided to declare the march an unlawful assembly after someone ripped a gun from a police officer's holster and pointed the weapon at him. The person was taken into custody, Batts said.

Johannes Mehserle, convicted of involuntary manslaughter, will get credit for time he's already spent behind bars since he was charged in the shooting of 22-year-old Oscar Grant on a train platform on January 1, 2009, a judge ruled Friday.

Mehserle could be released from custody in about seven months, according to sentencing guidelines provided by the prosecution.

Batts said members of the crowd broke windows and jumped on vehicles. A motorist struck a police officer, probably accidentally, said the chief, adding officers will arrest those who do not disperse. He estimated the crowd at between 300 and 500 individuals.

"Is it out of control?" Batts asked about the situation late Friday. "No. Is it secure right now? I believe it is."

Mayor Ron Dellums appealed to citizens to protest in a nonviolent manner.

Grant's mother, Wanda Johnson, appeared stunned as she left the courtroom. Her family's lawyer said she was appalled. Johnson had asked the judge to sentence him to the maximum 14 years in prison. She and four other family members who spoke at the sentencing hearing called Mehserle "a murderer."

"This is a slap in the face, a punch in the stomach," said John Burris, the Grant family attorney.

Prosecutors had asked for prison time, while the defense had argued for probation.

After the July verdict, police in downtown Oakland arrested dozens of angry protesters on a variety of charges, including failure to disperse, resisting arrest, burglary, vandalism and assaulting a police officer. The city planned to have extra officers on hand Friday in case they were needed, said police spokeswoman Holly J. Joshi.

Mehserle told Los Angeles County Superior Court Judge Robert Perry before sentencing Friday that he would be willing to go to prison if the sentence made his city and family safer.

"I shot a man," he said. "I killed a man. It should not have happened."

Alex Alonso, a writer for StreetGangs.com, said Mehserle appeared to weep at times while reading his apology to the judge. He seemed to avoid looking at Grant's family, Alonso said.

Mehserle, dressed in an orange jail jumpsuit, was shackled by chains around his waist linked to cuffs on his arms and legs, Alonso said.

"I wish I could bring Oscar Grant back," Mehserle said.

A conviction for involuntary manslaughter normally carries a four-year sentence, but the judge had the option of adding an "enhancement" that could have made the sentence 14 years because a firearm was used in commission of a crime.

Mehserle, who was on duty as a Bay Area Rapid Transit police officer when the shooting occurred, said at the trial that he intended to draw and fire his Taser rather than his gun. The jury acquitted him of the more serious charges of second-degree murder and voluntary manslaughter.

Grant family members expressed outrage after the verdict in July.

"My son was murdered. He was murdered. He was murdered. My son was murdered," Johnson said. She and others said African-Americans have too long been the victims of police abuse and a biased judicial system.

The trial had been moved from California's Alameda County to Los Angeles because of pretrial publicity. The shooting was captured on a bystander's cell-phone video camera. The video was widely circulated on the internet and on news broadcasts, and it spurred several protests and riots in and around Oakland.

The shooting took place after Bay Area Rapid Transit police were called to Oakland's Fruitvale station on January 1, 2009, when passengers complained about fights on a train. Officers pulled several men, including Grant, off the train when it arrived at Fruitvale.

The video showed Mehserle pulling his gun and shooting Grant in the back as another officer kneeled on the unarmed man. Mehserle resigned his position a few days after the incident and was later arrested in Nevada.

The former officer apologized to the public and described his memories of the moments after the shooting in a handwritten letter obtained by CNN after the verdict.

"For now, and forever, I will live, breathe, sleep, and not sleep with the memory of Mr. Grant screaming 'you shot me' and me putting my hands on the bullet wound thinking the pressure would help while I kept telling him 'you'll be okay,'" Mehserle wrote in the letter. "I tried to tell myself that maybe this shot would not be so serious, but I recall how sick I felt when Mr. Grant stopped talking, closed his eyes and seemed to change his breathing."

CNN's Stan Wilson and Phil Gast contributed to this report.