1993 f150 4x4 dropping out of gear

ford
f150

#1

driving home the other day in 4 wheel drive heard clunking noises and truk dropped out of gear like it was in nuetral. i kept pushing the 4 wheel high and low buttons and shifting the shifter untill it reingaged and managed to get back home. any ides what this may be.