This piece of Star Trek has been eating me for a while.
Many years ago, I saw an episode of Star Trek - it was either the original or TNG. The Enterprise crew comes across a strange device which turns out to be a weapon of "peace". It was advanced and powerful enough to destroy any known weapon. But it did not attack anyone who was unarmed and I recall the captain ordering the crew not to even "think" violent thoughts. The weapon then seemed pacified and caused no further harm.
Which series/episode was this? What was the name of the weapon?