Rapper Tory Lanez allegedly ordered Megan Thee Stallion to "dance, b----, dance" before firing a gun, striking her in the foot after a party last year.

The revelation was made during a court hearing Tuesday in which Los Angeles Police Detective (LAPD) detective Ryan Stogner testified that Lanez — whose real name is Daystar Peterson — shouted the order before shooting the 26-year-old in the foot, according to multiple reports on Tuesday.

Tory Lanez shouted ‘dance b--ch’ at Meg Thee Stallion before firing a gun and striking her in the foot, according to a detective. (Getty Images)

"[Megan] observed Mr. Peterson holding a firearm, and then she observed him start to shoot," Stogner Tuesday on the stand, per Rolling Stone. "Megan immediately felt pain to her feet, observed blood, fell to the ground, and then crawled to an adjacent driveway of a residence. … She described her injuries as bleeding profusely."

It was only after the alleged shooting that Peterson, 29, apologized to Stallion — real name Megan Pete — before he "offered her money and begged her to please not say anything," according to Megan's account. Megan also told the detective that Lanez made "a reference to the fact he was already on probation."

MEGAN THEE STALLION'S ALLEGED SHOOTER TORY LANEZ PLEADS NOT GUILTY TO ASSAULT CHARGES

Lanez, who was rumored to have been dating Stallion, was present in the courtroom listening to the testimony, Rolling Stone reported, adding that his attorney questioned the detective on whether he had asked Megan "how much she had to drink that day."

The detective also relayed that Stallion recounted Lanez being intoxicated during the July 2020 incident, according to TMZ.

A recent court hearing revealed that Lanez attempted to apologize to Meg Thee Stallion after the shooting and offered her money to not say anything. (Prince Williams/Wireimage via Getty Images)

CLICK HERE TO SIGN UP FOR THE ENTERTAINMENT NEWSLETTER

Following the shooting, Megan Thee Stallion released an op-ed in The New York Times calling for the protection of Black women.

In the piece titled, "Why I Speak Up For Black Women," the hip-hop star wrote that "Black women are still constantly disrespected and disregarded in so many areas of life."

"My initial silence about what happened was out of fear for myself and my friends," she wrote. "Even as a victim, I have been met with skepticism and judgment. 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."

CLICK HERE TO GET THE FOX NEWS APP

Meg Thee Stallion previously recalled "bleeding profusely" after being shot by Lanez to a LAPD detective. (Dia Dipasupil/Getty Images)

However, Lanez has maintained his innocence. The day after the rapper was charged, Lanez tweeted that "the truth will come to the light" and "a charge is not a conviction."

Megan Thee Stallion has had a breakout run in the past two years that has put her among the biggest stars in hip-hop. She was nominated for artist of the year at the MTV Video Music Awards, was the musical guest on the season premiere of "Saturday Night Live," and her guest stint on the Cardi B song "WAP" helped turn the track — and music video — into a huge cultural phenomenon.

Fox News' Melissa Roberto and the Associated Press contributed to this report.