A San Pedro gang member who fired a gun into the air moments before the weapon was used in a murder and two attempted murders was sentenced Thursday to four years in state prison.

However, Andrew Trejo, 29, was not placed in custody because he had served enough time in jail already – even though he has a new assault case pending.

Trejo had previously pleaded no contest to negligent discharge of a firearm in exchange for a sentence that equaled time served, according to Deputy District Attorney LaChandra Wilkerson.

But while Trejo was awaiting sentencing, he was out of jail on his own recognizance and arrested again.

Trejo and another man were charged with two counts of assault with a deadly weapon for a Jan. 28 attack of two people with a metal pipe, according to the criminal complaint. They are also accused of vandalizing a car belonging to one of the victims, the complaint adds.

Trejo’s criminal history, including previous convictions for violent crimes, is contained in the complaint, along with an allegation that he was out on bail when the new incident occurred.

But, to the dismay of the murder victim’s mother, Long Beach Superior Court Judge Arthur Jean refused to put Trejo back in custody.

“What’s it gonna take for him to be put where he can’t harm anybody anymore?” said Isabel Gutierrez, whose son, Michael Gutierrez, was killed on Jan. 23, 2005.

Gutierrez, 23, was shot by Hector Garcia Jr., 28, outside a party at a home in the 700 block of West Sixth Street.

Garcia, also a gang member, was in a confrontation with a rival over a tattoo, and Gutierrez intervened.

Across the street, Trejo fired a gun into the air and then Garcia, who was convicted by a jury earlier this month, retrieved it and used it to kill Gutierrez and shoot and wound two others.

Garcia is expected to be sentenced to life in prison on April 20.

Meanwhile, prosecutors delayed Trejo’s sentence until Garcia’s trial was complete. He was ordered to stay out of trouble while on bail.

According to Isabel Gutierrez, when Trejo came to court for sentencing, Wilkerson tried to get him back in custody on more than $1 million bail for the new case.

Defense attorney Henry Salcido, though, got the handcuffs off his client by noting that Trejo is legitimately out on the bail set by arresting officers from the Los Angeles Police Department’s Harbor Division.

In an interview, Salcido said his client is not scheduled to be arraigned on the new case until March 18, and did not agree to have the date pushed up.

Trejo was allowed to remain free on $30,000 bail.

When he returns to court, it’s likely prosecutors will again ask for an increase.

Salcido did not go into the details of the new case, but said his client was acting in a “defensive manner.”