OAKLAND — A judge set bail at $3 million Friday for the former BART police officer accused of killing a 22-year-old man at a BART station on New Year's Day.

Johannes Mehserle's explanation of how he shot Oscar Grant was inconsistent, and he was a danger to society and a flight risk, said Alameda County Superior Court Judge Morris Jacobson.

"That is the type of bail that will go a long ways toward ensuring future appearances in court," Jacobson said.

Mehserle's father whispered, "Oh my God" and shook his head from side to side as the judge spoke.

As of 8:30 p.m. Friday, Mehserle remained in the Santa Rita Jail in Dublin.

Mehserle, 27, is accused of murder in the killing of Grant on the Fruitvale Station platform as hundreds of passengers watched and recorded the event with cell phone cameras.

Those recordings show Mehserle standing over an apparently defenseless Grant, who is lying on his stomach with his hands behind his back. The videos show Mehserle pulling his pistol and shooting Grant in the back.

Mehserle's attorney argued his client had mistakenly believed that he was firing his Taser shock weapon, not his handgun. That made the crime, at most, involuntary manslaughter, argued attorney Michael Rains.

Rains said some witnesses said they heard Mehserle tell fellow officers, "get back, I am going to taze him."

Other witnesses and officers said that after the shooting Mehserle told fellow officers he thought Grant had a gun, court documents state.

The papers — obtained before Jacobson put a gag order on the parties — were the first explanation from either Mehserle or an attorney of the former officer's state of mind during the early hours of Jan. 1.

"The offense charged is serious," defense attorney Michael Rains wrote. "However, even a rudimentary and hasty examination of ... indicates that Mr. Mehserle did not act ... with malice against Mr. Grant when he fired his weapon."

According to the document, an officer said he heard Mehserle tell Grant to stop resisting and to put his hands behind his back, then saying, "I'm going to taze him, I'm going to taze him. I can't get his arms. He won't give me his arms. His hands are going for his waistband."

Instead of pulling his Taser, Mehserle pulled his gun and shot Grant in the back, the papers state. "Tony, I thought he was going for a gun," Mehserle told the officer, according to the document.

District Attorney Tom Orloff's office declined to release its own bail-hearing motion Friday afternoon, citing the gag order.

In court, Deputy District Attorney John Creighton focused on the conflict between saying he would use a Taser and later saying he thought Grant had a gun. If Mehserle thought Grant was trying to reach for a gun, he never would have said he was going to use his Taser, Creighton said.

Mehserle, he said, was trained to react to force with force, meaning he would have pulled his gun if he thought Grant had a gun.

Jacobson agreed.

"There appears to be a change in the story. His willingness to change his story appears to me that he would be willing to do so to avoid the consequences."

The conflicting reasons, coupled with a slaying "under the color of authority," made Mehserle a danger to society, the judge said.

He also said Mehserle's decision to go to Nevada after the shooting and his being unmarried contributed to his being a flight risk.

"When he felt under pressure, he didn't run to his parents' house in Napa, he ran to Nevada," the judge said.

Rains argued the prosecutors were too aggressive in charging murder instead of involuntary manslaughter, for which the bail would be, at most, $30,000.

Creighton argued that murder was the correct charge.

Describing the scene from the videos of the shooting, Creighton said Mehserle appears to have deliberately reached for his weapon.

"What we see in the video is an officer releasing his control of a suspect, standing up, drawing his weapon, with some difficulty, and shooting it," Creighton said.

Jacobson said he would not consider threats against Mehserle and his family, or public unrest in making his bail decision.

"Doing so would allow mob rule and public furor to set bail proceedings," the judge said.

While Rains' legal filing attempts to characterize Mehserle's state of mind, it does not quote Mehserle directly, instead using statements by others to describe the scene and the former officer's possible motives.

Mehserle resigned from the BART police force rather than give a statement about the slaying to BART officials who were investigating the death.

Outside the courthouse, a group of protesters set off on a march through downtown Oakland chanting slogans and holding signs that read "no bail, jail." Police arrested eight protesters after some minor scuffles.