A former western New York town judge who prohibited media from covering the arraignment of a state police major’s daughter charged with killing her boyfriend has promised he won’t seek re-election.

The New York State Commission on Judicial Conduct announced Wednesday that York Town Court Judge Walter Purtell agreed never to pursue or accept judicial office as part of his resignation, which took effect March 8.

The commission served him a formal written complaint on Nov. 3, 2016, alleging that he made “injudicious comments,” dismissed charges without notifying prosecutors and did not guarantee right to counsel at some arraignments.

“Is is essential to the rule of law for a judge to insure that al parties are afforded such fundamental protections as the right to counsel. Judge Purtell was charged with failing to do so, and his resignation, with a pledge never to return, is an appropriate resolution,” commission administrator Robert Tembeckjian said in a statement.

The commission said it also had been investigating formal complaints of misconduct against Purtell, a former state trooper, after he banned reporters from the high-profile arraignment of Danielle Allen in December. Allen pleaded not guilty to a manslaughter charge in the fatally stabbing of her boyfriend on Nov. 21 at a home in Livingston County.

Purtell, who is not an attorney, had served as the town judge since 1998. His current term expires Dec. 31.

He was represented by attorney Peter Skivington of The Law Offices of Peter K. Skivington in Geneseo, who could not be reached for comment Thursday.