Libertarian presidential nominee Gary Johnson provided little detail in a town hall Wednesday night on how he plans to defeat terrorism.

CNN host Anderson Cooper asked the former New Mexico governor in light of a knife attack against six people in London Wednesday, how Johnson would prevent attacks in the U.S.

"Maybe we're the kind of candidates that are gonna say, 'look, this stuff is gonna happen,'" Johnson said. "Yes, a president of the United States — we need to be vigilant to potentially prevent these things from happening, but these things are gonna happen."

Former Mass. Gov. Bill Weld, Johnson's running mate, jumped in, telling Cooper he would identify strategies the government has used to fight the Islamic State and al Qaeda that have not worked and implement new ones in their place.

Additionally, Weld said his preferred plan for defeating terrorists would be through human intelligence.

"There's no substitute for that — infiltration of those groups by whatever means available," Weld said.

The two candidates are opposed to most wars and said earlier in the segment the U.S. should have pulled out of Afghanistan months after deploying following the September 11, 2011 attacks.