A potentially damaging recording surfaced a decade ago, in the midst of what would become a successful campaign for county sheriff.

“I know exactly how to manipulate the law, and I’ve gotten pretty good at it,” Craig D. Apple Sr., then an undersheriff in Albany County, New York, was overheard telling a group of county investigators.

Mr. Apple was elected sheriff, and his tenure and popularity have led to him running unopposed in every election since.

Sheriff Apple, on the other hand, is now under a lot more scrutiny. The sheriff filed a criminal complaint against former Gov. Andrew M. Cuomo in October, charging him with a misdemeanor sex crime typically associated with accusations of unwanted sexual advances in public places — without involving the county district attorney’s office.

Mr. Cuomo and his associates have accused the sheriff of harboring old grudges against Mr. Cuomo and have referred to the law enforcement official as a “cowboy sheriff.” They have resurfaced the old recording in an attempt to cast doubt on Sheriff Apple’s integrity and his decision to charge the former governor.

They also claim that the sheriff planned the timing of the complaint with the state attorney general, Letitia James, who announced her candidacy for governor the day after the charge was made public. Although no evidence of coordination has emerged, Mr. Cuomo’s lawyer, Rita Glavin, stated that the timing “should give all of us pause that the heavy hand of politics is behind this decision.”

Other attacks have since occurred. Since August, when the sheriff revealed that he was looking into allegations that Mr. Cuomo groped an aide’s breast in the Executive Mansion, the sheriff’s office had received anonymous threats and hate mail targeting him and his family, which the sheriff presumes come from Cuomo supporters.

Sheriff Apple, 54, runs a department of roughly 700 deputies, correction officers, dispatchers, fire investigators and medical responders.

Sheriff Apple, who grew up in Bethlehem, a town just south of Albany, joined the department in 1987, just two years out of high school. Since then, he has been a near-constant presence in the local press, regaling reporters with tales of high-speed chases, a prolific jewel thief, mischievous teenagers, and even the torture of a snapping turtle.

Tall, rugged, and well-known for his love of cigars, the sheriff enjoys widespread community support for his numerous attention-grabbing efforts in matters unrelated to his job.

Matthew J. Miller, a Democratic county legislator and high school biology teacher in Selkirk, not far from where Sheriff Apple grew up, recalled how the sheriff responded to the 2014 strangulation death of 5-year-old Kenneth White in Knox, N.Y., part of the Hilltowns community in rural northwestern Albany County.

The sheriff arrived quickly, organized a vigil, and befriended the boy’s two surviving sisters, who were taken into custody by Child Protective Services. When a new family adopted the girls in the spring of 2019, he drove them from family court in a squad car with flashing lights and a siren.

The sheriff’s jurisdiction spans approximately 540 square miles, overlapping with the jurisdictions of local police departments in cities such as Albany, Bethlehem, and Cohoes. His office also runs the county jail, where allegations of torture were investigated after New York City banned solitary confinement for young inmates and then began transferring young inmates to Albany, where such restrictions did not exist.

However, the attention paid to that controversy pales in comparison to Sheriff Apple’s scrutiny since charging Mr. Cuomo with forcible touching, a misdemeanor sex crime that is punishable by up to a year in prison but often results in much shorter sentences.

The complaint is based on the testimony of Brittany Commisso, Mr. Cuomo’s former executive assistant. She accused Mr. Cuomo of reaching under her blouse to grope her breast while they were alone in the Executive Mansion late last year; Ms. Commisso was one of a dozen or so women whose sexual harassment allegations against Mr. Cuomo formed the basis of a state attorney general’s report, which eventually led to his resignation in August.