California has introduced a new bill that restricts the use of rap lyrics as evidence in court.
It follows the recent indictments of US rappers Young Thug and Gunna, whose lyrics have been directly quoted at them in an ongoing legal trial.
Young Thug has been accused of co-founding a gang as well as possessing stolen weapons and drugs - and in the indictment, lyrics from nine of his songs were mentioned.
One of them included: "I done did the robbin', I done did the jackin', now I'm full rappin.'"
According to Variety, one veteran music lawyer described this as "unprecedented racism".
Both rappers have been denied bond and will remain in jail until a trial begins in January 2023. They have denied the allegations against them.
The Decriminalising Artistic Expression Act aims to protect an artist's First Amendment rights, which guarantees freedom of speech.
It will stop a musician's works from being used during criminal and civil proceedings.
The Black Music Action Coalition described the bill as a "crucial step in the right direction" of not injecting racial bias into court proceedings.
California is the first state in the US to introduce such legislation - and from now on, lyrics can only be used against artists in court following judicial review.
Rappers Killer Mike, Meek Mill and Tyga were all present as Governor Gavin Newsom signed the bill into law.
Meek Mill tweeted: "I RESPECT YOU. Thank you. I understand the magnitude of the moves you make. We need help in the system!"
The chief executive of the Recording Academy, Harvey Mason Jr, told Variety: "Today we celebrate an important victory for music creators in the state of California.
"Silencing any genre or form of artistic expression is a violation against all music people."