“He was using his police status to get out of the trouble he was about to be in,” she said.

Chandler said prosecutors did not immediately charge him after his Aug. 21 arrest because further investigation was needed, including into the contents of his electronic devices.

She said the FBI reviewed those contents and found child pornography involving an 8-year-old boy.

Chandler said Hastings told investigators that after he was involved in a police shooting a few years ago, he began “doing riskier things.”

“He is reckless, he is cavalier,” she told Judge Bruce Mills.

Burke, the defense attorney, told Mills that her client “has been completely cooperative” and has not had any problems since his August arrest.

The judge decided to reduce Hastings’ bail to $100,000 and ordered him to return to court on March 7 to set a date for a preliminary hearing.

Hastings, a 13-year veteran of the San Francisco Police Department, was suspended without pay after his arrest.

Hastings is named in a federal civil rights lawsuit stemming from the 2011 death of Kenneth Harding, who police say accidentally shot himself during a shootout with Hastings and another officer after police tried to stop Harding for alleged fare evasion in San Francisco’s Bayview District.

At the time of the shooting, Harding was on parole in Washington after serving time for pimping a 14-year-old girl.

Advocates for Harding have questioned the Police Department’s version of events leading to his death, as well as whether it was necessary to use force against him.