We study the nonlocal energy where denotes the perimeter of a set with prescribed volume and is the weak solution of . This energy is related to the study of long and slender "needle" domains in uniaxial ferromagnetic materials where the second term models dipole interactions. We prove existence of minimizers and show that they are ( equivalent to) bounded, connected sets with smooth boundary. In particular we show that for local minimizers. For the physically important case , we furthermore establish a scaling law for the minimal energy in terms of the prescribed mass .