'NCIS' star Pauley Perrette attacked near home

Jayme Deerwester | USA TODAY

NCIS actress Pauley Perrette, who plays the show's Goth crime lab tech Abby Scuito, had a real-life scare Thursday in Los Angeles. A "psychotic homeless man" jumped her on the street outside her home and punched her in the face several times.

"I almost died tonight," she wrote on Twitter. "Tonight was awful, life changing and I'm only grateful to be alive."

Perrette recounted the incident in detail in an essay, which she photographed and attached to her post. In it, she said the man kept telling her his name (William) and that he was going to kill her. "I was alone, terrified and trapped," she said, grateful he hadn't dragged her to a empty garage nearby. "I knew if he got me in there, I was dead."

So, tonight was awful, life changing and I'm only grateful to be alive. It's here: pic.twitter.com/vXIT1pkVRc — Pauley Perrette (@PauleyP) November 13, 2015

Once the assailant finally left her alone, she collapsed on the sidewalk, where she went unnoticed and unaided by a man walking his dog and looking at his phone.

Then the actress' forensic knowledge from undergrad days and her top-rated crime drama kicked in, texting a neighbor and a cop she knew from church. "I immediately drew a police sketch of the guy," which her friends photographed and used to surveil the assailant and alert the police, who arrested him.

The attacker, whose name is actually David Merck, was booked on suspicion of aggravated battery with bail set at $100,000.

Los Angeles police Officer Jane Kim confirmed that the actress’ account of the attack was accurate, the Associated Press reports.

In her essay, Perrette, who works with charities for the homeless, pleaded for housing and full mental health care for them.