FILE - This Jan. 23, 2014 file photo made available by the Miami Beach Police Dept., shows Justin Bieber at the police station in Miami Beach, Fla. According to two people directly involved with the case, Justin Bieber will plead guilty to lesser chargesin his January arrest in South Florida after what police initially described as an illegal street drag race. The two people told The Associated Press Tuesday, Aug. 12, 2014, that the 20-year-old pop star would plead guilty to misdemeanor careless driving

Justin Bieber Pleads Guilty in Deal in Florida

MIAMI (AP) -- Pop singer Justin Bieber's guilty plea to charges of careless driving and resisting arrest puts an end to a legal saga that began seven months ago inside a rented Lamborghini at what police called an illegal drag race. The judge who accepted Bieber's plea Wednesday said it's time for the 20-year-old singer to stop his misbehavior - especially for his millions of young fans.

"I hope that he realizes that his actions not only lead to consequences that affect him but they lead to consequences that affect others that are looking up to him as a role model," Miami-Dade County Judge William Altfield said at a hearing. "He just hopefully will get the message. He will grow up. He will use his talents positively for young persons."

Bieber attorney Howard Srebnick said the judge's message will be relayed to the singer, who was not at the hearing.

"We will turn this into a positive experience," Srebnick said. "We're relieved that it's over."

The plea deal Bieber struck with prosecutors includes a 12-hour anger management course, a $50,000 charitable contribution already made to a local children's organization and a $500 fine. The deal allows Bieber to avoid a conviction of driving under the influence and includes no jail time. A charge of driving with an expired license was dropped when Bieber showed proof he had a valid one.

Bieber was arrested early Jan. 23 in Miami Beach after what police described as an illegal street race in an upscale residential neighborhood, with Bieber's Lamborghini and a Ferrari driven by R&B singer Khalil Amir Sharieff. Neither was charged with drag racing, and there was little evidence they were exceeding posted speed limits, although police said Bieber's security vehicles had blocked off one end of the road.

Still, Miami-Dade State Attorney Katherine Fernandez Rundle said Miami Beach officers were right to stop the pair.

"The ultimate purpose of the Miami Beach Police Department's initial traffic stop was to end some rash juvenile type conduct before a tragedy occurred," she said.

Alcohol breath tests found Bieber's level below the 0.02 limit for underage drivers, but urine tests showed the presence of marijuana and the anti-anxiety drug Xanax in his system. Bieber also was charged with resisting arrest after a profanity-laced tirade against police officers.

The urine test became a battle between Bieber's lawyers and media companies - including The Associated Press - seeking access to video of the test. The lawyers said it was an invasion of privacy. Ultimately, Altfield ordered the video released with sensitive portions blacked out. Other police video depicted Bieber walking unsteadily during a sobriety test.

In July, Bieber resolved another criminal case by pleading no contest to a misdemeanor vandalism charge for throwing eggs at a neighbor's house in Los Angeles. In that case, Bieber agreed to pay more than $80,000 in damages and meet a number of other conditions.

Bieber also is charged in Toronto with assaulting a limousine driver in late December. His lawyers have said he is not guilty in that case.

Back in Miami, Bieber is being sued by a photographer who says he was roughed up while snapping pictures of the singer outside a recording studio.

The Canadian-born Bieber shot to stardom at age 15, with his career overseen by two music industry heavyweights, singer Usher and manager Scooter Braun, after initially gaining notice through YouTube videos. He was nominated for two Grammy Awards for his 2010 full-length album debut "My World 2.0."