LOS ANGELES -- Rapper Tory Lanez pleaded not guilty through his attorney Wednesday to felony assault charges in the July shooting of hip-hop star Megan Thee Stallion.

Lawyer Shawn Chapman Holley entered the plea in a downtown Los Angeles courtroom to counts of assault with a semiautomatic firearm and carrying a loaded, unregistered firearm in a vehicle on behalf of Lanez, 28, who was not at the hearing.

In a criminal complaint, prosecutors said Lanez, whose legal name is Daystar Peterson, fired on a victim identified as “Megan P.†after she got out of an SUV during an argument in the Hollywood Hills on July 12, and “inflicted great bodily injury†on her. Megan Thee Stallion's legal name is Megan Pete. If convicted, Lanez faces a maximum sentence of roughly 23 years.

The Canadian rapper was charged in October after months of speculation and publicity surrounding the incident. At first, Los Angeles police reported the incident only as shots fired, a woman with foot injuries, and a man arrested on a weapons allegation.

Megan Thee Stallion, whose legal name is Megan Pete, revealed a few days later that her foot injuries came from gunshots, and more than a month later said in an Instagram video that it was Lanez who fired them. She slowly revealed more via social media in subsequent weeks.

“The way people have publicly questioned and debated whether I played a role in my own violent assault proves that my fears about discussing what happened were, unfortunately, warranted,†she wrote.

The day after he was charged, Lanez tweeted “the truth will come to the light,†and “a charge is not a conviction.â€

Lanez has not reached the stardom that Megan the Stallion has, but his album “Daystar,†released in September after the shooting but before he was charged, reached the top 10 on the Billboard album chart, and he has had a successful run of mixtapes and major-label records since his career began in 2009.

Megan Thee Stallion was already a major up-and-coming star at the time of the shooting, and since then, her guest stint on the Cardi B song “WAP†helped turn the track - and music video - into a huge cultural phenomenon, and she appeared on the season premiere of “Saturday Night Live.â€