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.
Prosecutor Keith Watanabe said the sentence calls for Malil to be eligible for parole in 12 years, but he 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, authorities said.
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 deliberated less than four hours before convicting 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.