Rapper Tekashi 6ix9ine is doing everything he can to get out of prison, and this time, he is requesting that a judge allow him to serve the remainder of his sentence at home - because he fears for his safety behind bars.

"Allowing Hernandez to serve the remainder of his jail sentence under home confinement would be the most reasonable means to adjust and prepare for his re-entry into the community," Tekashi's attorney Lance Lazzaro wrote to Manhattan federal court Judge Paul Engelmayer.

"It would be a grave injustice for Hernandez to be denied the reasonable opportunity to adjust to and prepare for his re-entry into the community due to his cooperation with the government and placement in a private facility by the government for safety reasons," the motion reads.

In December, Tekashi was sentenced to 24 months in prison but could be out before 2020 is over. Had he not cooperated with the feds, Tekashi could have spent up to 47 years in prison.