NEW YORK (AP) - Ja Rule agreed Monday to go to prison for two years in a gun case, becoming the second platinum-selling rapper set to do time after arrests in the aftermath of a star-studded hip-hop concert in July 2007.

The rapper-actor _ whose gravelly voice, thuggish tough talk and duets with R&B divas made him one of rap’s stars in the early 2000s _ pleaded guilty to attempted criminal possession of a weapon. Superstar Lil Wayne was arrested separately the same night and later pleaded guilty to the same charge.

Speaking in a low voice, Ja Rule said nothing beyond “guilty” and “yes” to a Manhattan judge’s questions as he admitted to a charge that involves attempting to have a loaded gun outside one’s home or workplace. Police said they found a loaded .40-caliber semiautomatic gun in a rear door of his $250,000-plus Maybach after it was stopped for speeding.

His plea deal promises the 34-year-old rapper a two-year prison term compared to the 15-year stint he could have faced if convicted of the original gun charges. He remains free until his sentencing.

“This isn’t a good day,” Ja Rule said as he headed to a waiting SUV, waving to some fans who recognized him behind his dark sunglasses. His lawyer, Stacey Richman, declined to comment.

He’s due in court Feb. 9 to set a date for his sentencing.

“Because of your guilty plea here today, you’ll have a record of having committed a violent felony. This is a very serious matter,” Manhattan state Supreme Court Justice Richard Carruthers told him Monday.

Ja Rule is the latest in a series of big-name rappers poised for incarceration, a lineup that has raised questions about the line between art and reality in a genre rife with tales of gang life. Hip-hop stars including Tupac Shakur, Lil’ Kim, Foxy Brown, Shyne, Mystikal, Gucci Mane and T.I. have been in jail or prison for periods ranging from months to years. Lil Wayne spent eight months in a New York City jail earlier this year.

He and Ja Rule were stopped, separately, after leaving the Beacon Theatre on July 22, 2007. Lil Wayne had just headlined a show there featuring other rappers including Ja Rule; the two had recently joined forces on a single called “Uh Oh.”

About an hour after Ja Rule’s car was pulled over, Lil Wayne’s tour bus was stopped about a mile away. He admitted last year that he had a loaded, semiautomatic .40-caliber gun on the bus.

Lil Wayne, 28, was sentenced in March to a year in jail, gaining early release last month because of time off for good behavior.

Manhattan prosecutors declined to compare the rappers’ cases and plea deals. In another recent Manhattan gun case that grabbed headlines, former New York Giants wide receiver and Super Bowl hero Plaxico Burress pleaded guilty last year to the same charge of attempted weapon possession and was sentenced to two years in prison. He had brought a loaded handgun to a nightclub, and the weapon went off and shot him in the leg.

Under state prison policies, Ja Rule might be able to shave up to six months off his sentence by meeting behavior and other requirements.

Ja Rule’s road manager and uncle, Dennis Cherry, and the artist’s driver, Mohamed Gamal, were arrested with him. Cherry has pleaded not guilty to weapon-possession charges and is due back in court next week. Gamal has since died.

Ja Rule, born Jeffrey Atkins, scored a Grammy Award nomination in 2002 for the best rap album with “Pain is Love.” He also has appeared in movies, including the 2001 film “The Fast and the Furious” and 2003’s “Scary Movie 3.”

After emerging as a hardcore rapper in the late 1990s, Ja Rule became known for his collaborations with female R&B singers, including Ashanti. He also garnered notoriety for his public feuds with other rappers, including 50 Cent, who trashed him as a gangsta wannabe in songs and interviews in the early 2000s.

Their tiff echoed on Twitter on Monday, as 50 Cent posted a series of variously mocking and somewhat empathetic comments about Ja Rule’s guilty plea.

Ja Rule has had previous brushes with the law, including pleading guilty to assault for punching someone at a Toronto nightclub in 2004. He said he was provoked by a crowd shouting derogatory remarks about his beef with 50 Cent.

At the time, a Toronto judge rejected prosecutors’ request to ban the rapper from possessing firearms for 10 years. Ja Rule was fined $1,200.

Originally from Queens, Ja Rule has lived in Upper Saddle River, N.J., in recent years with his wife and children.