The rapper the Game has been charged with hitting and threatening an off-duty Los Angeles police officer during a basketball game at Hollywood High School, prosecutors said.

The 35-year-old Compton native, whose name is Jayceon Terrell Taylor, faces one felony count of making criminal threats and one misdemeanor count of assault and battery in the March 29 encounter, according to the Los Angeles County District Attorney’s office.

Taylor pleaded not guilty in a downtown Los Angeles court Monday. If Taylor is convicted, he faces up to three years in prison.

He and the off-duty police officer were on opposing teams during the basketball game when the match suddenly became heated.

Prosecutors said Taylor was accused of committing a hard foul, then approached the officer and struck him.

Saying the "very sad" story of a 6-year-old girl shot and killed in Moreno Valley "hit me in a place nothing ever has," Compton rapper The Game has pledged $10,000 to Tiana Ricks' family for her funeral, his representative confirmed to The Times.

The 33-year-old, whose real name is Jayceon Terrell...

(Kate Mather and Angel Jennings)

The charges come two weeks after a Los Angeles Superior Court judge ordered Taylor to pay $200,627 to Karen Moore, a former employee, for defamation and inflicting emotional distress.

Moore, a nanny who once worked for six different celebrity families, claimed that in June 2013, Taylor published false statements about her on Instagram and Twitter, which damaged her reputation and caused her to lose work.

At the time, he urged his roughly 1.1 million Twitter followers and 1.2 million Instagram followers, “Don’t let anymore children become her victim.”

Taylor’s comments were later republished by 17 other websites, according to court documents.

She received death threats and was fired from a job. Moore said she was “ostracized in the industry.”

“The likelihood that I will be able to attain another job as a celebrity nanny is doubtful given the attention given to defamatory statements defendant made about me,” she said in court documents.

Because of the online harassment, she sought therapy for depression, experienced mood swings and took medication, according to court documents.