Officials said three foreign militants - possibly from Uzbekistan - and two local Pakistanis were killed when they accidentally detonated explosives stored in a home .