Justin BieberCops Plea DealIn Miami DUI

8/13/2014 3:41 AM PDT BY TMZ STAFF

Justin Bieber has struck a plea deal in his Miami Beach DUI case in which he will agree to anger management but dodge a drunk driving bullet.

TMZ has learned ... prosecutors will allow Bieber to plead guilty to careless driving and resisting an officer without violence.

Bieber will have to attend a 12-hour anger management courses and has agreed to a $50,000 charitable donation.

Sources tell TMZ ... Bieber's lawyer, Roy Black, had one big concern ... that Bieber NOT be placed on probation, for fear he'd go to jail if he violated even a minor law ... something you can count on with the Biebs.

It's not a surprise prosecutors accepted a lesser plea. There were big problems with the case. It appears the cop lied when he said JB was drag racing and that police could smell alcohol when he hadn't been drinking.

This is Bieber's second plea deal. He pled no contest to misdemeanor vandalism in the egging case, was placed on 2 years probation, 5 days labor, ordered to pay his neighbor $80,900 and he was ordered to attend anger management classes.