Shelley Malil was sentenced by San Diego County Superior Court Judge Harry Elias three months after a jury convicted the actor of attempted premeditated murder and assault with a deadly weapon. The victim, Kendra Beebe, suffered punctured lungs and wounds to her neck, chest, back and arms in the 2008 attack.
Seated before the court, Malil apologized for stabbing Beebe and said he wanted to go to prison.
"I want to do whatever I need to do to make sure I make right from the wrong that I did," he said.
"Kendra Beebe did not deserve anything that happened to her. ... I can't even begin to imagine what she has been through," he added.
Before the sentencing, Beebe also spoke to the court about the physical and emotional pain she suffered.
"Despite the stab wounds he inflicted, I am alive," she said, going on to say Malil's testimony had not been credible.
"During the course of the trial it became clear he was an actor, but not a very good actor at that. His testimony was lie after lie after lie," she said.
The sentence makes Malil eligible for parole in 12 years, but prosecutor Keith Watanabe said Malil could be freed in as few as nine years taking into account time already served and good behavior.
Malil, 45, testified at trial that he visited Beebe at her San Marcos home in suburban San Diego in August 2008 to apologize for taking personal items from her house and to warn that he e-mailed sexually explicit photos of the couple to her co-workers. He stabbed her with a kitchen knife after finding her drinking wine with another man.
The couple began dating in 2007 when Beebe responded to online personal ad and had a stormy relationship, authorities said. Two days before the attack, Malil stranded Beebe and her cousin at the beach, stole marijuana and other items from her home and locked her out of her house.
Malil - who played Haziz, a co-worker of Steve Carell's character in "The 40-Year-Old Virgin" - had faced a maximum penalty of life in prison with no possibility for parole for 14 years.
His attorney argued there was no doubt Malil went too far when he picked up a kitchen knife and began stabbing Beebe, but said Malil never intended to kill the woman. The defense also questioned Beebe's credibility as a witness and described her as a violent drama queen who tried to make men jealous.
The jury convicted the actor of the two most serious charges and acquitting him of residential burglary.
Prosecutors said Malil quarreled with Beebe the day before the attack, stranding her at the beach and stealing marijuana and other items from her home.
Malil fled the house after neighbors heard Beebe's screaming. He was arrested the next day at an Amtrak station in nearby Oceanside.
After the sentencing, Beebe told reporters she believed justice was served and that she hoped Malil's apology was sincere.