The suspect told family members he was going to carry out an extreme act.
He was caught on the corner of Sokolov and Achad Haam streets in the city.
Investigators are continuing to search for possible accomplices, but police say the danger to Herzliya residents is over.
According to reports, the suspect fought with his father before leaving his family home in the East Jerusalem neighborhood of Tsur Baher saying he planned to carry out an attack.
Dozens of officers had combed the town, a Tel Aviv suburb, since the morning, when the suspect evaded a police checkpoint in Yerushalayim. The car was later found abandoned in the center of Herzliya.
Herzliya Mayor Moshe Fadlon said he had ordered a massive increase in security at schools, kindergartens and other places where large numbers of people might gather.
Police called on the public to remain vigilant and contact the police if they saw anything or anyone suspicious.
Located just north of Tel Aviv, Herzliya is home to a large business and high-tech district where several of the country’s largest firms have offices.
Many foreign diplomats and other high-level officials also call the seaside Herzliya Pituach neighborhood home.
Officials said the search was unrelated to an ongoing manhunt for an Israeli Arab man wanted for opening fire in a Tel Aviv bar Friday, killing 2. Read more at Times of Israel.