I think this may help here:
Program (P) mode flash.
The overriding principle of Program (P) mode in flash photography is that the camera tries to set a high shutter speed so that you can hold your camera by hand and not rely on a tripod. If that means the background is dark, so be it.
Program mode operates in one of two modes, depending on the ambient (existing) light levels.
1) If ambient light levels are fairly bright (above 13 EV) then P mode assumes you want to fill-flash your foreground subject. It meters for ambient light and uses flash, usually at a low-power setting, to fill in the foreground.
2) If ambient light levels are not bright (below 10 EV) then P mode assumes that you want to illuminate the foreground subject with the flash. It sets a shutter speed between 1/60 sec and the fastest X-sync speed (see above) your camera can attain. The aperture is determined by the camera’s built-in program.
Because the camera tries to keep the shutter speed at a reasonable speed for handholding the camera you will end up with dark or black backgrounds if you take a flash photo in P mode when ambient light levels are not bright.
On most if not all EOS cameras, P mode is not shiftable when flash (internal or shoe-mounted Speedlite) is used. Note also that DEP mode cannot work correctly with flash - its metering settings basically revert to P mode if you try it.
Taken from
http://photonotes.org/articles/eos-flash/index2.html#fillflash
HTH
BOM