In its ruling on Tuesday, the court found Lanez guilty of all three charges against him, including negligent discharge of a firearm, assault with a semiautomatic firearm, and carrying a loaded and unregistered firearm.
Lanez, whose real name is Daystar Peterson, has been in the public eye since he shot Megan in both feet after the duo left a house party in Hollywood Hills in July 2020.
A viral video also showed the female rapper walking up a street limping with blood stains trailing her legs.
Last year, Lanez was charged with shooting the 25-year-old female rapper.
In December, the LA court convicted him of the three charges and ordered his remand in custody until his sentencing.
The case, which was earlier scheduled to hold in January, resumed this week.
David Herriford, judge of the Los Angeles superior court, handed down the sentence to the singer on Tuesday.
Herriford said it was “difficult to reconcile” the kind and good father many people described Lanez as being with the person who fired the gun at Megan Thee Stallion.
“Sometimes good people do bad things,” the judge said.
“Actions have consequences and there are no winners in this case.”
On Monday, Megan testified that Lanez offered her $1 million (£830,000) to conceal the incident because he was on probation for a weapon offence.
“Since I was viciously shot by the defendant, I have not experienced a single day of peace,” she added in a written statement that was read in court.
“Slowly but surely, I’m healing and coming back, but I will never be the same.”
The rapper had earlier described the incident as a “traumatic night”. She also said she is “extremely grateful to be alive”.
Copyright 2023 TheCable. All rights reserved. This material, and other digital content on this website, may not be reproduced, published, broadcast, rewritten or redistributed in whole or in part without prior express written permission from TheCable.
Follow us on twitter @Thecablestyle