The embattled chief of the Anne Arundel County Police department said Wednesday that he would retire next month amid criticism of his handling of allegations against the county’s top executive.

The resignation of Police Chief James Teare was announced in a statement from the Office of the State Prosecutor Emmet C. Davitt, who secured an indictment this spring of County Executive John R. Leopold. Davitt said his office would end its criminal investigation of Teare in light of his decision to step down.

“It is important to resolve this matter without any further disruption to the effective functioning of the police department at a time when it is reorganizing and the Anne Arundel county executive is under indictment,” Davitt said in a statement.

Teare’s decision follows calls for his resignation from the Anne Arundel County Council and the local Fraternal Order of Police. In a two-sentence statement Wednesday, Teare said he has “cherished the opportunity to serve.”

In March, Leopold was indicted on charges of official misconduct for allegedly using county police officers for personal and political purposes. Leopold is accused of using his security detail, for instance, to maintain dossiers on his political opponents and to set up sexual encounters with a subordinate. When police officers reported their concerns to Teare, “no effective action was taken by the chief,” according to the indictment.

Leopold’s case is scheduled to go to trial in September. Judge Dennis M. Sweeney this week denied Leopold’s motion to dismiss the case, saying in his ruling that “there is sufficient protection to the defendant from being convicted for conduct that is truly innocent in nature.”