A homeless man has pleaded not guilty to attacking and threatening to kill NCIS actress Pauley Perrette.

Forty-five-year-old David Merck entered pleas Monday to false imprisonment by violence and making a criminal threat.

He could face up to four years in prison if convicted.

Pauley Perrette Attacked: “I Almost Died Tonight”

Actress Pauley Perrette tweeted Friday morning that she was assaulted overnight by a “psychotic homeless man” who said he was going to kill her.

The NCIS star posted a tweet including an image of a long document that described the incident.

“I am shaken and traumatized,” she wrote. “My life changed tonight.”

Perrette, 46, wrote that as she was walking from her Hollywood home to a guest house, a man grabbed her and punched her in the face and told her repeatedly he was going to kill her.

Pauley Perrette

Pauley Perrette

“He grabbed me so forcefully, pinned my arm, punched me in the nose, forehead repeatedly telling me he was going to kill me,” she tweeted. “Then he showed me how he was going to kill me.”

The actress said her attacker said his name was William and after she told him he has a beautiful name and her nephew shares his name, he began to hit her again.

“He started to punch me again and then said, ‘Get the f–k out of here,’ and I did.” The actress wrote that she then collapsed on the sidewalk and a dog being walked by its owner licked her face.

“Some guy walked right past with a dog that licked my face. He was on his phone, annoyed. Did nothing,” she wrote.

Perrette then texted her friend next door and her “church friend cop.” She drew a sketch of her attacker for police and her friend, James, snapped a picture of the sketch on his phone.

“[He] was headed towards Hollywood Blvd with murder in his eyes…[James] found the guy, surveilled him, the cops came and followed James to him. They got him. Felony assault.”

Richardo Hernandez of the LAPD confirmed to FOX411 that a white male, David Merck, was arrested on battery charges and is currently being held on $100,000.

According to sources, Merck has yet to fire a lawyer.

Sgt. Bob Ward told the Los Angeles Times that Merck was a known transient with a history of run-ins with the department.

Perrette reflected on her experience at the end of her note leaving the following message: “We need full mental health care. We need housing and help for the homeless. We need to support our cops. We need to not walk alone. I need to heal.”

She ended the note saying, “I almost died tonight.”