A Ukrainian husband hacked off an alleged rapist’s penis after witnessing him attacking his wife, according to reports.

The 27-year-old man was headed home in Shevchenkovo in eastern Ukraine on Saturday when he saw the alleged attacker, Dmitry Ivchenko, sexually assaulting his wife after the couple ate with friends at a restaurant, The Sun reports.

The victim left the eatery first, with her husband following about 10 minutes later. The man then heard a commotion in bushes near his apartment before spotting Ivchenko, 25, choking his wife as he raped her, according to the report.

After punching Ivchenko in the head, the woman’s husband used his Swiss Army knife to cut off Ivchenko’s penis, according to local reports.

“The husband lost the ability to control his actions,” his attorney, Dmitry Spaskin, said. “He did not understand what he was doing.”

The husband – still in a “state of shock” after the gory assault – then walked more than 8 miles to a neighboring village, where he asked a friend to take him to a police station.

Spaskin told the Daily Mail that his client “confessed in full” early Sunday to cutting off Ivchenko’s penis.

The unidentified spouse, who was charged with causing grievous bodily harm, was sentenced to house arrest, The Sun reports.

It’s unclear whether doctors will be able to reattach Ivchenko’s penis. He had surgery at a hospital but will require extended treatment, a doctor told The Sun.

Officers were stationed at Ivchenko’s hospital as an investigation into the alleged rape continues.

“The rapist said that he was dumped by his girlfriend a week ago,” prosecutor Tetiana Vasileva said. “On the day of the incident, he drank a liter of vodka. He is refusing to say more so far.”