Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A Pennsylvania judge sentenced rapper Meek Mill to two to four years in prison on Monday for violating his probation.

Common Pleas Court Judge Genece E. Brinkley cited a failed drug test and unapproved travel, stemming from a 2008 gun and drug case. He was immediately taken into custody.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Brinkley said she had given Mill multiple chances but he hasn't complied. According to evidence from probation officers, the musician tested positive for narcotics numerous times.

The sentence was unexpected as prosecutors recommended Mill not be imprisoned for the probation violations, mentioning he's been drug-free since January and has complied with most requirements of probation. Mill's lawyer, Brian McMonagle, has vowed to appeal the sentencing.

Robert Williams, also known as Rapper Meek Mills. via WCAU

Mill — born Robert Rihmeek Williams — has been arrested twice this year. Mill was arrested in March at St. Louis International Airport and charged with misdemeanor assault after an altercation with two airport employees.

Related: Nicki Minaj Promises to Keep Meek Mill in Check

In August, he was stopped for reckless endangerment while driving his motorcycle in New York City. Both cases were dropped after he agreed to fulfill community service requirements.

Brinkley has worked with Mill since nearly a decade ago, when the rapper was convicted and jailed for eight months and later placed on probation in 2008 for gun and drug charges. In 2016, he was placed under house arrest for 90 days after violating travel restrictions.