We propose that a magnetic pinning mechanism is the dominant flux-pinning mechanism of proximitycoupled, planar defects when the field is parallel to the defect. We find compelling evidence that this pinning mechanism is responsible for the strong flux-pinning force exerted by ribbon-shaped ␣-Ti precipitates and artificial pins in Nb-Ti superconductors, instead of the core pinning mechanism as has been hitherto widely believed. Because the elementary pinning force f p (H) is nonmonotonic when it is optimum ͑i.e., when the defect thickness t and the proximity length N have comparable dimensions͒, the total pinning force F p (H) generally does not show temperature scaling. Characteristic changes in the magnitude and shape of F p (H) at constant T but at different t/ N ͑e.g., different Nb-Ti wire diameters͒ are also direct consequences of the pinning mechanism. The optimum flux-pinning state is a compromise between maximizing f p and getting the highest number density of pins. For a given defect composition this state is reached when tϳ N /3, while for varying defect composition the peak F p gets higher when N is made shorter. Artificial pinning center Nb-Ti wires having short N pins appear to be vital for obtaining high J c at high fields because only then is the elementary pinning force optimized at small pin thicknesses which permit a high number density of vortex-pin interactions and a large bulk pinning force. We find verification of our predictions in experimental F p (H,T,t) data obtained on special laboratory-scale artificial pinning-center Nb-Ti wires.