MIAMI — 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.

The plea deal includes a 12-hour anger management course, a $50,000 charitable contribution and a $500 fine.