DENVER — Patrick Sullivan was the kind of lawman Coloradoans loved: a straight-shooting Republican sheriff who once crashed a Jeep through a fence to rescue two deputies from a gunman and pleaded with legislators to keep assault weapons off the street lest any more citizens get shot.

On Tuesday afternoon, though, investigators from the same sheriff’s department he oversaw for nearly two decades found themselves monitoring a home near Denver that Mr. Sullivan was seen entering.

Soon after, the police arrested Mr. Sullivan, now 68 and long retired from the Arapahoe County sheriff’s office, on charges that he had been trying to exchange methamphetamines for sex with a man. He was booked that night at a local county jail that proudly bears his name.

“The Arapahoe County sheriff’s office is saddened, and this is a sad time for our community,” said Grayson Robinson, the current sheriff, who served under Mr. Sullivan. “But we have a greater purpose, to serve our community with integrity and professionalism, and that’s exactly what we’ve done with this investigation.”