Laser-driven source of spin-polarized atomic hydrogen and deuterium