SAN JOSE — A judge denied bail Monday to a San Jose police officer accused of rape, consigning him to jail until his trial on charges that could put him in prison for up to 53 years to life.

The ruling by Superior Court Judge JoAnne McCracken was a devastating reversal of fortune for Officer Geoffrey Graves, 39.

Until last week, Graves had been free on $100,000 bail, which he posted about a year ago after he was arrested for allegedly raping an illegal immigrant he met Sept. 22, 2013, on a disturbance call. The judge had Graves taken into custody last week after the prosecution moved during his preliminary hearing to add new charges that exposed him to a possible life sentence. But the officer and his supporters held out hope that the judge would relent Monday.

McCracken, however, sided with prosecutor Carlos Vega, holding Graves over for trial not only on the original rape and on domestic violence charges he faced in connection with his ex-girlfriend, but also on five new enhancements. Now, instead of facing a maximum of 13 years in prison if he is convicted, he could be sentenced to 53 years to life. The enhancements include unlawful entry with intent to commit rape, being armed with a firearm and use of a firearm.

The judge found that Graves in recent years has displayed a pattern of volatility, impulse control and violence, and now poses both a threat to public safety and a flight risk.

“There is clear and convincing evidence that the risk of great bodily injury (to the alleged rape victim in particular and to the public) exists in this case,” McCracken ruled.

The late afternoon ruling came as a disappointment to Graves and his friends and relatives, about 20 of whom showed up in court Monday morning to show the judge their support. But there were no visible tears, unlike last week when Graves and his father sobbed as he was abruptly handcuffed and taken into custody. Last week, he was wearing a yellow jail shirt, a color indicating someone is on suicide watch. However, Monday, he clad was in a brown shirt, signaling he was in protective custody.

Graves remains on paid administrative leave. However, Vega told the court that the officer will soon be fired, claiming his looming lack of employment also makes him a greater flight risk.

The judge cited several factors for her decision to keep Graves locked up, including testimony by his ex-girlfriend, who is a San Jose police dispatcher, that he blew up at her more than a dozen times during their relationship, sometimes violently.

She also cited a threat he allegedly made recently to a Safeway clerk in Gilroy. When the clerk declined to sell him a bottle of vodka in the middle of the night because of a state law prohibiting the sale of alcohol between 2 a.m. and 6 a.m., the officer allegedly said, “Why don’t I just punch you in the (expletive deleted) face,” then grabbed the bottle and threw down a $20 bill. According to a police report, he later lied about the incident to a police officer who stopped his car because it matched the description the clerk gave.

McCracken also noted that Graves lied recently to a pre-trial services worker who was weighing his suitability for release, saying he did not have a problem with drugs or alcohol even though he’d gone into rehab while he was active on the force.

“There’s a concern there,” she said. “The defendant appears not to have any appreciation (of his addiction problems).”

The judge also noted that Graves’ ex-wife had to get an emergency protective order against him within the past four years because he chased her down in a car and cut her off during an argument about whether their son, now 9, should go to public or private school.

“This is someone who has been law-abiding, a community servant,” the judge said, noting that Graves has volunteered as a baseball coach and been a firefighter. “Then something happened in the last several years.”

Contact Tracey Kaplan at 408-278-3482. Follow her at Twitter.com @tkaplanreport.