A Prince George’s County ­police officer accused of taking upskirt photos of “unsuspecting women” pleaded guilty Tuesday morning to misconduct in office and related charges in connection with the case.

James Sims pleaded guilty in Prince George’s County Circuit Court to four counts of visual surveillance with prurient interest and two counts of misconduct in office for the images he captured, some taken while he was on duty conducting traffic stops, according to the Prince George’s County state’s attorney’s office.

“Officer Sims was entrusted with protecting and serving the citizens of this county and through his actions, he violated that trust,” Angela Alsobrooks, the state’s attorney for Prince George’s, said in a statement announcing the plea.

The investigation into Sims began in June, when an off-duty officer at a Sports Authority in Bowie reported that Sims had taken an upskirt photo of her, prosecutors said.

She confronted him and chased him into the parking lot, where she saw him get into a marked county police cruiser, prosecutors said.

Police began investigating the woman’s complaint and discovered additional incidents that occurred between May and June 2015.

Sims, who has been with the department since 2010, was immediately suspended after authorities received a complaint about him.

Police took the case to the county state’s attorney’s office for criminal review last year, and a grand jury handed down charges against Sims.

When the charges were announced against Sims, Police Chief Hank Stawinski said the conduct was “disgusting” and betrayed the community’s trust.

Sims faces up to a year in prison on the visual-surveillance charges.

The charges for misconduct in office are open-ended as long as they don’t “exceed anything cruel and unusual based on the crime committed,” prosecutors said.

Sims is scheduled to be sentenced Feb. 17.