The stoichiometries and structures of LiNbO3 and LiTaO3 doped with Ni2+ and Co2+ have been established through a combination of phase diagram determination, Rietveld refinement of powder X-ray diffraction data, extended X-ray absorption fine structure spectroscopy on the Ni, Co K edges, and magnetic measurements. Extensive ranges of Ni2+, Co2+-containing solid solutions form by the principal substitution mechanism 3Li + Nb,Ta reversible arrow 4Ni,Co. A secondary substitution mechanism, observed with both doped and undoped LiNbO3 and LiTaO3 is 5Li reversible arrow Nb, Ta. All results are consistent with substitution of Ni2+, Co2+ onto primarily the Li sites but sometimes, depending on composition, also onto Nb/Ta sites; in both cases, the sites have off-center, distorted octahedral coordination. The doped compositions can be divided into two regions: first, region II in which the Nb/Ta sites are full but Li sites contain a random mixture of Li, Ni/Co, Nb/Ta, and vacancies; these have the general formula [Li, Ni/Co, Nb/Ta, square C][Nb/Ta]O-3 where square is a cation vacancy. Second, region I in which there is insufficient Nb/Ta to fully occupy their own sites, the balance is made up of Ni/Co and the Li sites contain Li, Ni/Co, and vacancies, i.e., [Li, Ni/Co, square][Nb/Ta, Ni/Co]O-3. Regions I and II are separated by a line of constant Nb/Ta content in which the substitution mechanism 2Li reversible arrow Ni, Co occurs. On this line, Nb/Ta sites are fully occupied and Li sites contain a mixture of Li, Ni/Co, and vacancies. Magnetic measurements support the valency of both dopants (Co2+ and Ni2+ in high-spin state) and show the presence of weak magnetic coupling between these dopants at 4 K.