A terrified burglar has handed himself to police in New Zealand after breaking into a house and stumbling across a body hanging in the dark.

His screams alerted neighbours in the North Island town of Hamilton, who thought it was a domestic dispute.

Police said the hanged man had died hours before the burglary, but might otherwise not have been found for days.

They said they hoped the encounter would prove a life-changing moment for the burglar.

"Hopefully there will be a positive out of it and that he will decide it's not the thing to do. I would be taking that as pretty bad karma," Hamilton Police senior sergeant Freda Grace told the New Zealand Herald.

She described the circumstances of the discovery early on Wednesday morning as being "incredibly sad".

Police say that the would-be burglar will not be charged and the death is not being treated as suspicious.