R. Kelly got put in a really bad spot by guards at the Chicago prison where he's locked up, and then they ignored his concerns of being in danger before he got attacked ... according to his legal team.
The disgraced singer's attorneys, Steven Greenberg and Nicole Blank Becker, tell TMZ ... a lot of the animosity toward Kelly within the Metropolitan Correctional Center is due to some of the prison guards telling the inmates that they had to go on lockdown because of protests outside the facility for R. Kelly.
Kelly's legal team suggests it's strange for guards to make such announcements, and believe this caused the other prisoners to become upset with him.
We're told, 3 weeks before Kelly's attack, he overheard his alleged attacker -- a fellow inmate -- outside his cell talking on a phone and saying things indicating he might attack the singer.
According to Kelly's side ... he expressed his concerns the next day to a prison guard when Kelly had to ride in the same elevator as the allegedly menacing inmate, saying he didn't trust him. We're told they had to ride together anyway.
A few days later ... Kelly allegedly told a doctor from medical he wished guards would stop telling everyone he's the reason for lockdowns because the other inmates were getting mad.
The singer claims he also told at least 2 other guards he feared for his safety in the 2-3 weeks leading up this his attack ... but says they didn't take his concerns seriously.
We broke the story ... a pissed off inmate allegedly walked into Kelly's cell and began kicking him. The fight didn't last long and Kelly didn't suffer any major injuries, but the altercation shows he's not immune to being a target of violence.
The Federal Bureau of Prisons has declined to comment on the incident, and the U.S. Attorney's Office for the Northern District of Illinois and the Eastern District of New York have not responded to requests for comment.