That's an excellent question, as a loose or flimsy lid is a constant battle for homeowners. The "most secure" mechanism truly depends on what you're trying to keep out—is it raccoons, stray dogs, high winds, or simply containing odors?
After looking at various options, locking lids are generally considered the most secure for outright prevention. These function much like a latch on a toolbox, requiring a button press or a key to open. They are highly effective against intelligent pests like raccoons and deter casual rummaging. However, they add a step to taking out the trash.
A very close second are the clamp-on or screw-down lids. These create a tight, often silicone-sealed, barrier that is extremely difficult for animals to pry open. They are also superb at containing smells and preventing spills in windy conditions. The downside is they can be less convenient for frequent disposal.
For a balance of security and convenience, weighted or magnetic lids are a strong choice. The lid stays firmly in place due to its own heft or a magnetic seal, but it's easy to lift with a foot pedal. While a determined animal might eventually defeat it, it stops most casual attempts.
Ultimately, for maximum security against clever pests and the elements, a locking or screw-down lid mechanism is your best bet. For general use where convenience is also key, a robust, weighted, and well-fitted lid will serve you perfectly.