Caught in a recent firestorm of ethics violations, Sheriff James DiPaola of Middlesex County apparently took his own life in a Maine hotel this weekend.

DiPaola, 57, was found dead in a Wells, Maine, hotel room Saturday morning after missing checkout.

He was found on the bed with a gunshot wound to his head, police said.

Also found in the room was a four- or five-page note, according to the Globe. Officials did not disclose its contents.

The Globe reported last week that DiPaola was preparing to take advantage of a state loophole that would allow him to collect his pension while still collecting a check as the recently re-elected county sheriff. As a result, he announced last week his intention to resign early next year.

Fox 25 also reported last week that DiPaola’s office was being investigated as part of an ethics complaint about improper campaign contributions as well as having a staffer serve as a personal designated driver.

“This is a shocking and tragic event. I extend my deepest condolences to the DiPaola family and to the sheriff’s staff. ... Sheriff DiPaola had a 30-year record of public service. … We honor that service and pray for his family,” Gov. Deval Patrick said.

The sheriff’s office said Special Sheriff John Granara will take over operations until a replacement is named.