Ray J's sexual battery and assault case in Beverly Hills will be wiped away -- for the most part -- after his attorney struck an amazing plea deal ... TMZ has learned.
Honestly, Houdini's got nothing on Ray J ... who is pleading no contest to misdemeanor trespassing. Ready for the Houdini part? The other charges for sexual battery, assault on a police officer, and resisting arrest ... will all be dismissed.
TMZ broke the story when Ray was busted at the Beverly Wilshire Hotel back in May for allegedly grabbing a woman's breast, and then getting into a violent altercation with arresting officers. He kicked out the window of a BH PD patrol car.
The plea deal requires Ray to be on probation for 3 years, do 50 hours of community service, 12 anger management counseling sessions, and 12 alcohol therapy sessions.
He will have to stay away from the hotel and pay back Bev Hills PD for the car window.