A Novato High School student who was ambushed and killed last month had several fingers hacked off with a machete, while his injured friend was able to survive by pretending to be dead, authorities said Wednesday.

The prosecution disclosed additional details about the attack during a bail hearing for Elmer Machado-Rivera, 21, of San Rafael, who is charged with being an accessory after the fact.

Machado-Rivera is accused of driving the three alleged killers from the crime scene. He has been held without bail since his arrest last month.

Deputy District Attorney Geoff Iida conceded that a bail amount should be set for the accessory charge, which only carries a maximum sentence of three years. But he argued that bail should be set at $1 million because of the “heinous” nature of the crime.

The prosecutor said the victims — Edwin Ramirez Guerra, 17, and Llefferson Diaz, 17 — were apparently lured into an ambush on a path. Diaz, who was shot in the chest and cut with a machete, “played possum” to make the killers think he was dead, Iida said.

Then the attackers chased down Guerra. He was shot in the head and had his fingers hacked with a machete, according to Iida. Guerra died at the scene.

In further argument for the $1 million bail threshold, Iida cited Machado-Rivera’s alleged association with a Salvadoran gang, and the likelihood he would flee prosecution if he is released.

Machado-Rivera’s lawyer, Christopher Morales, said bail should be $10,000. He described Machado-Rivera as a hard worker and former College of Marin student who has no criminal record and has local ties to a responsible family.

“Maybe he should have stopped the car and kicked them out, but he didn’t,” Morales said, referring to the alleged killers.

Judge Andrew Sweet set the bail at $750,000. He said that if the allegations are true, Machado-Rivera has already shown a willingness to obstruct justice because he helped the suspected killers escape the area.

Machado-Rivera has pleaded not guilty. He returns to court June 29 for further proceedings.

The judge denied an Independent Journal application to take Machado-Rivera’s photograph in court. The prosecution had objected to the photograph, saying it could compromise an investigation still in its early stages.

The homicide occurred May 25 in the open space area near the end of Fairway Drive in the Country Club neighborhood of Novato. After the killers left, Diaz went into the neighborhood to get help.

Authorities identified three suspects in the ambush. The prosecution said the attack appears to be gang-related.

Juan Carlos Martinez Henriquez, 17, and Edwin Guevara, 16, were arrested in Novato the next day. Martinez and Guevara, like the two victims, were students at Novato High School and members of the Junior ROTC program, according to the Marin County Sheriff’s Office.

The third suspected attacker, Guevara’s brother Javier, 19, remains a fugitive. Authorities said he is a member of a Salvadoran gang.

Machado-Rivera, the alleged accessory, is the cousin of the Guevara brothers. He allegedly received a call to meet the suspects at the crime scene the afternoon of the homicide.

Machado-Rivera followed the other suspects in his car after the slaying as they drove to San Francisco. Then he gave Martinez a lift home, according to the sheriff’s department.

Martinez told Machado-Rivera that he had attacked two Guatemalans and that it would be on the news, according to a statement Machado-Rivera gave to sheriff’s investigators.

Martinez and the Guevara brothers are charged with murder and attempted murder. Martinez and the elder Guevara are also charged with mayhem, a count that alleges maiming or dismemberment.

The two juvenile suspects are charged as adults. They have yet to enter pleas and return to court June 29.

Sheriff’s investigators are still working to track down Javier Guevara, who has a warrant out for his arrest.

Martinez is also a suspect in the alleged rape of a Novato High School girl near the campus a week before the homicide. He was arrested and booked into Juvenile Hall in that case, then released pending further investigation by police and prosecutors.

Authorities have not alleged a direct connection between the reported rape and the homicide.