BISMARCK, N.D. (AP)  A North Dakota police chief has been charged with 52 felonies accusing him of molesting and attempting to rape a girl over the course of about five years, the authorities said.

Randall Hoffman, the chief of police in the small community of Elgin, about 90 miles southwest of Bismarck, is accused of having sexual contact with the girl beginning in 2005, according to a criminal complaint that was released on Friday. It accuses Mr. Hoffman of engaging “in at least 50 sexual acts” with the girl, who is now 17, from August 2008 until this month and then trying to rape her on Wednesday.

Mr. Hoffman, 55, a former state district judge, is charged with a single count each of gross sexual imposition and continuous sexual abuse of a child. The sex abuse charge carries a maximum penalty of life in prison without the possibility of parole. He also faces 50 counts of corruption or solicitation of a minor, each of which carries a maximum penalty of five years in prison.

Elgin is a community of about 700 people, and Mr. Hoffman was its only police officer, prosecutors said. He had been chief since 2005, Mayor Duane Schatz said, and has been on administrative leave since his arrest on Wednesday.