Vehicle will only switch from park when in neutral

Last night while driving home in the rain, I cleared the windows with the wipers, and lowered the rear passenger window so that my dog could have air. I then proceeded to drive. I then lowered and raised my drivers side window and the passenger window to clear them of rain drops so that I would have an unobstructed view. I turned off the wipers, as it was only misting and then closed the rear passenger window. About 3 minutes later, I wanted to wipe off the windshield again, however, the wipers would not come on. I then played with the window buttons trying to open them, but they would not open, and the interior lights would not come on. However, the doors would lock and unlock. I thought for a second, maybe the anti-theft system engaged somehow. By this time I was sitting at an intersection - at a red light, waiting to turn left. I shut the car off, to see if something in the vehicles’ computer system needed to reset itself. I waited a couple of seconds, and then restarted the engine. By this time, the light had turned green, however, I could not get the car to switch from park to drive. I tried numerous times, but to no avail, the vehicle was stuck in park. To make a long story short, a while later after the police came, one of the officers googled the problem for a 2002 Ford F-150 truck on his car computer. He found that the vechicle had to be turned off to where the dashboard lights were on, foot pressed on the brake, and only then could the gear be switched into neutral in order to be started. Only after going through this routine was I able to shift the vehicle into drive. Would anyone know what the problem could be? This is the first time this problem has ever occured. The vehicle has138,500 miles. Can anything be done to resolve the issue? I await your expertise.

I suspect that the first problem was a fault in the Body Control Module that controls the vehicle’s bodily functions. Since it was raining, it may be a short to ground via an eroded wireing insulator. This might be tough to find.

Regarding the shifting, my car also won’t shift out of park unless the brake pedal is depressed. This is a common safety feature in modern vehicles. It’s common enough that I suspect it may even be required by the DOT for Over the Road Vehicles.