'40-Year-Old Virgin' Actor: I Stabbed My Girlfriend More Than 20 Times Thinking She Was Someone Else

“The 40-Year-Old Virgin” actor Shelley Malil said he stabbed his girlfriend more than 20 times after mistaking her for an attacker in the dark, according to a report from People magazine.

While testifying in a California courtroom Thursday, Malil pleaded not guilty to charges of premeditated attempted murder, assault with a deadly weapon and residential burglary.

Malil, 45, testified that he never intended to hurt or murder Kendra Beebe, 38, on the night of the attack in 2008.

“I’m sorry, I had no idea,” Malil said. “I saw the pictures for the first time, I was stunned. When I look at those pictures, I still can’t believe the knife I was holding was responsible for all those injuries.”

Malil, best known for his role as an electronics store employee in the Steve Carell comedy, took the stand in his own defense. He is facing 21 years to life if convicted.

Beebe, who survived the brutal attack, testified against the actor, who said he still doesn’t remember all the details of the night.

According to People, Malil claimed he arrived at her home on the night of the attack to find her drinking wine with a male friend named David Maldonado. Malil said he felt threatened by Maldonado and was sure he would attack him with a gun following a scuffle.

“I heard the chair behind me backing up,” he said. “I reach for the knife … I grab the handle and he’s pulling my arm and I’m pulling away from him.”

Moments later, he said he assumed Maldonado was “going for something else.”

“I follow him to the kitchen. I’m almost positive this guy’s got a gun and coming after me,” he said. “I come around the corner. It’s eerily quiet. All of a sudden, out of nowhere, I get hit from the back on the side of the head. It felt like cold granite countertop.”

That was when Malil said he began slashing and “going crazy,” before Beebe finally shouted “Call 911.” At that point, he claimed he realized he was stabbing her and stopped immediately.

Beebe has testified that Malil only backed away after a neighbor intervened.

“He said, ‘Kendra, Kendra, Kendra,” she said under oath earlier this month. “I saw a flash of silver and he goes, bang, bang, bang,” demonstrating how he stabbed her in the torso.

Prosecutors allege that Malil used two different knives. Beebe suffered a punctured lung as a result of the attack.

The trial resumes Monday.