A Brooklyn man convicted of attacking two police officers was sentenced to eight years in prison Tuesday, Brooklyn District Attorney Kenneth Thompson said in a statement.

In June 2012 Jonathan Truluck, 34, punched Officer Shanell Parker when she and her partner, Officer Michael Sommer, approached him and his brother. He was convicted earlier this month on two counts of second-degree assault, Thompson said.

The men had started to scream and draw a crowd after the officers told them to move from outside a known-drug location in Bedford-Stuyvesant, Thompson said.

Truluck then whipped Sommer with a belt with a metal padlock on it.

Parker suffered a fractured pinky finger and swelling to her face. Thompson said Sommer needed four staples on his head.

In the brawl another officer broke Truluck's ankle with a baton. During the trial prosecutors played a recorded phone call from Rikers Island in which Truluck bragged about "whipping" the officers.