Why Engine dies after stepping on brake. on 1999 Chevrolet S10

When driving step on the brake to stop and the high beam light comes on and the engine dies. The engine won't crank after occasionally the starter clicks and sounds like its searching for ground. Its grounded well can anyone help ?

Asked by for the 1999 Chevrolet S10