Officials in northern Mexico say a man accidentally trapped himself in a hole he'd dug so that he could spy surreptitiously on his former girlfriend, in violation of a restraining order.

The attorney general's office for the state of Sonora said Sunday that the 50-year-old spent days digging the hole in Puerto Penasco, on the Gulf of California, only to become trapped inside and require assistance to get out. The man had been ordered to stay away from his ex-girlfriend due to domestic violence charges. He is now in jail.

Violence against women is in Mexico's spotlight this week after a woman was hit by a car and stabbed to death by her husband outside the governor's residence in the western state of Jalisco. That incident was captured on video.