A formalism is developed for obtaining ab initio effective core potentials from numerical HartreeFock wavefunctions and such potentials are presented for C, N, O, F, Cl, Fe, Br, and I. The effective core potentials enable one to eliminate the core electrons and the associated orthogonality constraints from electronic structure calculations on atoms and molecules. The effective core potentials are angular momentum dependent, basis set independent, and stable against variational collapse of their eigenfunctions to core functions. They are derived from neutral atom wavefunctions using a pseudo-orbital transformation which is motivated by considerations of the expected accuracy of their use and of basis set economy in molecular calculations. Then the accuracy is demonstrated by multiconfiguration Hartree-Fock calculations of potential energy curves for HF, HCl, HBr, HI, F2, Cl2, Br2, and I2 and one-electron properties for HF and HBr. The differences between valence-electron calculattons employing the present effective core potentials and all-electron calculations are smaller than differences due to basis set choices, even though the basis sets are extended ones. Thus the effective core potentials are quite successful. In addition larger configuration mixing calculations are performed for HBr and Br2 (1637 and 3396 configurations, respectively) and again the effective core potentials are judged to perform well.