Robert Dartt, a former Cook County correctional officer, said he lost his job, his wife and his self-respect after he unnecessarily beat a jail detainee in October 2011.

Then, he found himself “begging for forgiveness” Thursday over his “one stupid mistake” that led to a federal indictment and an end to a public safety career that included service in the U.S. Marine Corps.

Moments later, U.S. District Judge Elaine Bucklo sentenced Dartt, 47, to four months in jail. In doing so, she predicted other officers would take note of Dartt’s additional suffering in the past six years.

“I think the message will be loud and clear,” Bucklo said.

The jail detainee goaded Dartt into the Oct. 31, 2011, attack with words like, “f— you” or “f— you, b—-,” court records show. Dartt entered the detainee’s cell and immediately punched him in the face in an assault caught on video.

Four junior officers followed him into the cell and watched.

Dartt grabbed the detainee’s face, gouged his eyes with his thumbs, threw him to the ground and stomped “on or near” the detainee’s head and back with his boot, records show.

“My temper and his temper got the best of us,” Dartt told Bucklo on Thursday.

The feds say the assault left the detainee with cuts, scrapes, bruises and swelling. They also said Dartt lied on official reports when he claimed the inmate had taken an aggressive stance with closed fists, and that Dartt was trying to prevent injury to himself and the staff.

“You couldn’t have been in danger from him,” Bucklo said before handing down Dartt’s sentence.

Dartt pleaded guilty in May to deprivation of rights under color of law. He is the third former law enforcement officer sentenced at the Dirksen Federal Courthouse in less than five weeks. Two ex-Chicago cops were recently sentenced in separate cases to five years in prison. Marco Proano was sentenced for using unreasonable force, and Ronald Coleman was sentenced for obstruction of justice.