It's a question that's been asked before:
https://duckduckgo.com/?q=icp+magnets
With the jack it was probably going inadvertently going over-center on a fulcrum point.
I have a better handle on electromagnets than permanent magnets. Look for History and Theory of Electricity (aka The Theory of Anti-relativity) by Eric P. Dollard on Youtube. It's 3 1/2 hours.