Rapper Ja Rule left a New York state prison Thursday morning after serving most of his two-year sentence for illegal gun possession, but ended up heading straight in to federal custody for a tax case, Associated Press reported.

The I'm Real rapper, whose real name is Jeffrey Atkins had been in protective custody at the Mid-State Correctional Facility because of his celebrity status and was escorted out of Mid-State Correctional Facility at 9:30 a.m. He was being held at the Oneida County Jail, as he waited to hear word from the Federal Bureau of Prison about where he'd serve his time in the tax case.

Ja Rule went to the prison in June 2011, and is getting out at his earliest release date, state correction spokeswoman Linda Foglia said. He had two misbehavior reports for unauthorized phone calls in February 2012 and had work assignments on lawn and grounds crews and participated in education programs, she said.

In the gun case, New York City investigators said they discovered a loaded .40-caliber semiautomatic gun in a rear door his $250,000 car after he was pulled over for speeding. Ja Rule pleaded guilty to that charge in 2010.

 In March 2011 , the rapper admitted in federal court that he did not pay his taxes on more than $3 million he earned between 2004 and 2006, while living in New Jersey.

The rapper may have less than six months left and may be eligible for a halfway house, according to his defense attorney Stacey Richman. She added that an order to pay $1.1 million in back taxes is one of the main reasons he wants to get back to work.

"I in no way attempted to deceive the government or do anything illegal," he told the judge. "I was a young man who made a lot of money - I'm getting a little choked up - I didn't know how to deal with these finances, and I didn't have people to guide me, so I made mistakes."

Ja Rule won a Grammy Award nomination in 2002 for the best rap album with Pain is Love. He also appeared in movies, including The Fast and the Furious in 2001 and Scary Movie 3 in 2003.

Watch Ja Rule talk about his prison sentence in May 2011:

Tags: ja rule