Guards found the black Zanca mobile in a tin of powdered milk following a search of Freddie Carruthers’ cell, on December 16, 2017.
The search was carried out after his ex-girlfriend complained he had been in touch, said prosecutor Donna Fawcett.
David Cusack, mitigating, said police only interviewed Carruthers in April, while he was serving a 40-month prison term for possession with intent to supply, imposed in June 2017.
“He was persuaded to take the phone and hold on to it for hoodlums that were going to use it from time to time.”
He said Carruthers was lonely and used it on different occasions.
But he had to spend nearly 24 hours a day in solitary, for fear of reprisals, after the phone was found, and he was attacked with a blade in front of officers.
“Ever since the phone was found in his cell he has done his best to secure an early release,” Mr Cusack said.
Four days before he was due to be released on October 6, he was told he would have to come to Mansfield to answer for possessing the phone.
If the case was adjourned to Nottingham Crown Court, Carruthers said he would face the same gang, Mr Cusack said.
“He is not some kingpin running a criminal empire, he is a minnow caught outside his area, being run by hoodlums.”
Carruthers, 27, currently of HMP Wymott, Lancashire, admitted possession of the phone, when he appeared at Mansfield Magistrates Court, on Wednesday.
He was handed a four month sentence, suspended for a year, and must carry out 60 hours of unpaid work.
The phone was forfeited, and he was ordered to pay a £115 government surcharge.