A selection theorem of Helly type and its applications