LOS ANGELES — Ashton Kutcher testified at a Los Angeles murder trial Wednesday that he went to pick up a 22-year-old fashion-design student to go out for drinks one night 18 years ago and left when she did not answer her door, only to learn the next day that she had been lying inside dead.

The actor said from the witness stand that he had kept Ashley Ellerin waiting for hours on Feb. 21, 2001, when he arrived at the her Hollywood home, where he had been to a party about a week earlier.

"I knocked on the door and there was no answer," Kutcher said in the packed downtown courtroom during the trial of Michael Gargiulo, who is charged with killing Ellerin and another woman. "I knocked again, and once again, no answer. At this point I pretty well assumed she had left for the night, and that I was late, and she was upset."

Kutcher said he looked through the window and saw what he thought were wine stains on the floor, but did not find that alarming, and left.

"I remember the next day after I heard about what happened, I went to the detectives and said, 'My fingerprints are on the door,'" Kutcher testified. "I was freaking out."

Ellerin's roommate found her dead in the hallway outside her bathroom. Prosecutors allege Gargiulo, whom they called a "serial sexual-thrill killer," entered the house and stabbed Ellerin 47 times.

Gargiulo has pleaded not guilty to two charges of murder and one of attempted murder in attacks between 2001 and 2008. He is charged separately with killing an 18-year-old Glenview, Illinois, woman, and is awaiting trial there.

Kutcher, a 41-year-old veteran actor best known for his roles in the goofy sitcoms "That '70s Show" and "Two and a Half Men," is now a father of two married to actress Mila Kunis after divorcing first wife Demi Moore.

But he was testifying about a time nearly two decades earlier when he was a single man and star-on-the-rise after three seasons of "That '70s Show." He was coming off the hit movie comedy "Dude, Where's My Car?" and a series of starring film roles would follow.

Looking nothing like the shaggy, casual characters he has often played, Kutcher wore a blue linen suit with his hair short and a trimmed mustache as he gave 40 minutes of somber testimony in the courtroom of Judge Larry P. Fidler.

Called as a witness by prosecutors, Kutcher said he had recently reviewed the police report he had given the day after the killing, to refresh his memory. He was briefly cross-examined and his answers were not challenged.

Ellerin has been described as Kutcher's girlfriend, but he said Wednesday that she had been a casual acquaintance whom he had met a few months before at a party, and was going to take her out now that both were single.

Kutcher said he had called Ellerin in the afternoon from the set of "That '70s Show," where he had just finished rehearsing. He last spoke to her at about 8:30 p.m., when he said he was at a friend's house and she was just getting out of the shower.

He said he did not arrive at her house until about 10:45 p.m. He called her in the interim four times and could not reach her but assumed it was bad phone service.

"Eighteen years ago, cell service wasn't it what it was today," he said.

He said he did not leave messages every time he called.

"I was trying to take her on a date and didn't want to seem eager," Kutcher testified.