Hello Cowichan,
The device is a neutral safety switch for the engine. A cable runs to the switch to interrupt the starter unless transmission selector is in "P" or "N". In addition the switch also controls the reverse lights.
It sounds like your cable kinked causing the transmission linkage to bind. Also check the plastic bushing in each end of the linkage rod from the shifter to the automatic transmission. These can age and crumble away causing the rod to fall off or become loose.
Joe Alexander
Blacklick, Ohio