Image caption Ja Rule wants to keep busy behind bars, he says he plans to write a book and take up the guitar

Rapper Ja Rule has been sentenced to up to two years in prison on gun charges by a court in New York.

Dressed in a grey sweat suit, he said "see y'all later" to fans and family as he was handcuffed and led away from the Lower Manhattan courthouse.

The multi-platinum rapper and actor plead guilty to attempted criminal weapon possession last December after police found a gun in his car in 2007.

Ja Rule, 35, could be released in as little as 18 months for good behaviour.

Police said they stopped the rap star's Maybach sports car for speeding and found a loaded, unregistered .40-caliber semiautomatic gun in a rear door.

He was charged under a New York law that generally bars people from having firearms outside their homes or workplaces.

New album

The musician spent the final days before his prison term putting finishing touches on his next album: "Pain Is Love 2", which is expected out in late July or early August, says his manager Ron Robinson.

Ja rule says he wants to make the most of his time in prison.

Image caption Ja Rule's family and fans were in the court room

He recently told TMZ.com he plans to keep busy behind bars by writing a book, studying for exams and possibly taking up the guitar.

"I'm gonna try to make good of my time while I'm inside," he told the entertainment site.

The musician is also facing the possibility of a federal prison sentence for failing to pay taxes on more than $3 million in income. He pleaded guilty to those charges in March.

Born Jeffrey Atkins, Ja Rule emerged as a hard core rapper in the late 1990s.