A 22-year-old who killed six people in a rampage through a California college town before taking his own life said in a chilling manifesto that police nearly foiled his plot when they visited him last month.

Less than a month before the attacks, Elliot Rodger — the son of a Hollywood director who was a former student at Santa Barbara City College — answered a knock at the door from about seven officers who were looking for him.

"I had the striking and devastating fear that someone had somehow discovered what I was planning to do, and reported me for it," Rodger said in the manifesto.